Merge pull request #4464 from devansh-webkul/issue-4399

Fixed role-based security issue in which user with no permission has acces to some admin pages/controls #4399
This commit is contained in:
Glenn Hermans 2021-01-15 12:19:17 +01:00 committed by GitHub
commit 1368124ed4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
31 changed files with 671 additions and 232 deletions

View File

@ -1,12 +1,31 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Dashboard
|--------------------------------------------------------------------------
|
| All ACLs related to dashboard will be placed here.
|
*/
[
'key' => 'dashboard',
'name' => 'admin::app.acl.dashboard',
'route' => 'admin.dashboard.index',
'sort' => 1,
], [
],
/*
|--------------------------------------------------------------------------
| Sales
|--------------------------------------------------------------------------
|
| All ACLs related to sales will be placed here.
|
*/
[
'key' => 'sales',
'name' => 'admin::app.acl.sales',
'route' => 'admin.sales.orders.index',
@ -16,17 +35,72 @@ return [
'name' => 'admin::app.acl.orders',
'route' => 'admin.sales.orders.index',
'sort' => 1,
], [
'key' => 'sales.orders.view',
'name' => 'admin::app.acl.view',
'route' => 'admin.sales.orders.view',
'sort' => 1,
], [
'key' => 'sales.orders.cancel',
'name' => 'admin::app.acl.cancel',
'route' => 'admin.sales.orders.cancel',
'sort' => 2,
], [
'key' => 'sales.invoices',
'name' => 'admin::app.acl.invoices',
'route' => 'admin.sales.invoices.index',
'sort' => 2,
], [
'key' => 'sales.invoices.view',
'name' => 'admin::app.acl.view',
'route' => 'admin.sales.invoices.view',
'sort' => 1,
], [
'key' => 'sales.invoices.create',
'name' => 'admin::app.acl.create',
'route' => 'admin.sales.invoices.create',
'sort' => 2,
], [
'key' => 'sales.shipments',
'name' => 'admin::app.acl.shipments',
'route' => 'admin.sales.shipments.index',
'sort' => 3,
], [
'key' => 'sales.shipments.view',
'name' => 'admin::app.acl.view',
'route' => 'admin.sales.shipments.view',
'sort' => 1,
], [
'key' => 'sales.shipments.create',
'name' => 'admin::app.acl.create',
'route' => 'admin.sales.shipments.create',
'sort' => 2,
], [
'key' => 'sales.refunds',
'name' => 'admin::app.acl.refunds',
'route' => 'admin.sales.refunds.index',
'sort' => 4,
], [
'key' => 'sales.refunds.view',
'name' => 'admin::app.acl.view',
'route' => 'admin.sales.refunds.view',
'sort' => 1,
], [
'key' => 'sales.refunds.create',
'name' => 'admin::app.acl.create',
'route' => 'admin.sales.refunds.create',
'sort' => 2,
],
/*
|--------------------------------------------------------------------------
| Catalog
|--------------------------------------------------------------------------
|
| All ACLs related to catalog will be placed here.
|
*/
[
'key' => 'catalog',
'name' => 'admin::app.acl.catalog',
'route' => 'admin.catalog.index',
@ -41,16 +115,31 @@ return [
'name' => 'admin::app.acl.create',
'route' => 'admin.catalog.products.create',
'sort' => 1,
], [
'key' => 'catalog.products.copy',
'name' => 'admin::app.acl.copy',
'route' => 'admin.catalog.products.copy',
'sort' => 2,
], [
'key' => 'catalog.products.edit',
'name' => 'admin::app.acl.edit',
'route' => 'admin.catalog.products.edit',
'sort' => 2,
'sort' => 3,
], [
'key' => 'catalog.products.delete',
'name' => 'admin::app.acl.delete',
'route' => 'admin.catalog.products.delete',
'sort' => 3,
'sort' => 4,
], [
'key' => 'catalog.products.mass-update',
'name' => 'admin::app.acl.mass-update',
'route' => 'admin.catalog.products.massupdate',
'sort' => 5,
], [
'key' => 'catalog.products.mass-delete',
'name' => 'admin::app.acl.mass-delete',
'route' => 'admin.catalog.products.massdelete',
'sort' => 6,
], [
'key' => 'catalog.categories',
'name' => 'admin::app.acl.categories',
@ -71,6 +160,11 @@ return [
'name' => 'admin::app.acl.delete',
'route' => 'admin.catalog.categories.delete',
'sort' => 3,
], [
'key' => 'catalog.categories.mass-delete',
'name' => 'admin::app.acl.mass-delete',
'route' => 'admin.catalog.categories.massdelete',
'sort' => 4,
], [
'key' => 'catalog.attributes',
'name' => 'admin::app.acl.attributes',
@ -91,6 +185,11 @@ return [
'name' => 'admin::app.acl.delete',
'route' => 'admin.catalog.attributes.delete',
'sort' => 3,
], [
'key' => 'catalog.attributes.mass-delete',
'name' => 'admin::app.acl.mass-delete',
'route' => 'admin.catalog.attributes.massdelete',
'sort' => 4,
], [
'key' => 'catalog.families',
'name' => 'admin::app.acl.attribute-families',
@ -111,7 +210,17 @@ return [
'name' => 'admin::app.acl.delete',
'route' => 'admin.catalog.families.delete',
'sort' => 3,
], [
],
/*
|--------------------------------------------------------------------------
| Customers
|--------------------------------------------------------------------------
|
| All ACLs related to customers will be placed here.
|
*/
[
'key' => 'customers',
'name' => 'admin::app.acl.customers',
'route' => 'admin.customer.index',
@ -136,11 +245,46 @@ return [
'name' => 'admin::app.acl.delete',
'route' => 'admin.customer.delete',
'sort' => 3,
], [
'key' => 'customers.customers.mass-update',
'name' => 'admin::app.acl.mass-update',
'route' => 'admin.customer.mass-update',
'sort' => 4,
], [
'key' => 'customers.customers.mass-delete',
'name' => 'admin::app.acl.mass-delete',
'route' => 'admin.customer.mass-delete',
'sort' => 5,
], [
'key' => 'customers.addresses',
'name' => 'admin::app.acl.addresses',
'route' => 'admin.customer.addresses.index',
'sort' => 2,
], [
'key' => 'customers.addresses.create',
'name' => 'admin::app.acl.create',
'route' => 'admin.customer.addresses.create',
'sort' => 1,
], [
'key' => 'customers.addresses.edit',
'name' => 'admin::app.acl.edit',
'route' => 'admin.customer.addresses.edit',
'sort' => 2,
], [
'key' => 'customers.addresses.delete',
'name' => 'admin::app.acl.delete',
'route' => 'admin.customer.addresses.delete',
'sort' => 3,
], [
'key' => 'customers.note',
'name' => 'admin::app.acl.note',
'route' => 'admin.customer.note.create',
'sort' => 3,
], [
'key' => 'customers.groups',
'name' => 'admin::app.acl.groups',
'route' => 'admin.groups.index',
'sort' => 2,
'sort' => 4,
], [
'key' => 'customers.groups.create',
'name' => 'admin::app.acl.create',
@ -160,7 +304,7 @@ return [
'key' => 'customers.reviews',
'name' => 'admin::app.acl.reviews',
'route' => 'admin.customer.review.index',
'sort' => 3,
'sort' => 5,
], [
'key' => 'customers.reviews.edit',
'name' => 'admin::app.acl.edit',
@ -172,15 +316,215 @@ return [
'route' => 'admin.customer.review.delete',
'sort' => 2,
], [
'key' => 'configuration',
'name' => 'admin::app.acl.configure',
'route' => 'admin.configuration.index',
'sort' => 5,
'key' => 'customers.reviews.mass-update',
'name' => 'admin::app.acl.mass-update',
'route' => 'admin.customer.review.massupdate',
'sort' => 3,
], [
'key' => 'customers.reviews.mass-delete',
'name' => 'admin::app.acl.mass-delete',
'route' => 'admin.customer.review.massdelete',
'sort' => 4,
],
/*
|--------------------------------------------------------------------------
| Marketing
|--------------------------------------------------------------------------
|
| All ACLs related to marketing will be placed here.
|
*/
[
'key' => 'marketing',
'name' => 'admin::app.acl.marketing',
'route' => 'admin.cart-rules.index',
'sort' => 6,
], [
'key' => 'marketing.promotions',
'name' => 'admin::app.acl.promotions',
'route' => 'admin.cart-rules.index',
'sort' => 6,
], [
'key' => 'marketing.promotions.cart-rules',
'name' => 'admin::app.acl.cart-rules',
'route' => 'admin.cart-rules.index',
'sort' => 1,
], [
'key' => 'marketing.promotions.cart-rules.create',
'name' => 'admin::app.acl.create',
'route' => 'admin.cart-rules.create',
'sort' => 1,
], [
'key' => 'marketing.promotions.cart-rules.copy',
'name' => 'admin::app.acl.copy',
'route' => 'admin.cart-rules.copy',
'sort' => 1,
], [
'key' => 'marketing.promotions.cart-rules.edit',
'name' => 'admin::app.acl.edit',
'route' => 'admin.cart-rules.edit',
'sort' => 2,
], [
'key' => 'marketing.promotions.cart-rules.delete',
'name' => 'admin::app.acl.delete',
'route' => 'admin.cart-rules.delete',
'sort' => 3,
], [
'key' => 'marketing.promotions.catalog-rules',
'name' => 'admin::app.acl.catalog-rules',
'route' => 'admin.catalog-rules.index',
'sort' => 1,
], [
'key' => 'marketing.promotions.catalog-rules.create',
'name' => 'admin::app.acl.create',
'route' => 'admin.catalog-rules.index',
'sort' => 1,
], [
'key' => 'marketing.promotions.catalog-rules.edit',
'name' => 'admin::app.acl.edit',
'route' => 'admin.catalog-rules.edit',
'sort' => 2,
], [
'key' => 'marketing.promotions.catalog-rules.delete',
'name' => 'admin::app.acl.delete',
'route' => 'admin.catalog-rules.delete',
'sort' => 3,
], [
'key' => 'marketing.email-marketing',
'name' => 'admin::app.acl.email-marketing',
'route' => 'admin.email-templates.index',
'sort' => 7,
], [
'key' => 'marketing.email-marketing.email-templates',
'name' => 'admin::app.acl.email-templates',
'route' => 'admin.email-templates.index',
'sort' => 1,
], [
'key' => 'marketing.email-marketing.email-templates.create',
'name' => 'admin::app.acl.create',
'route' => 'admin.email-templates.create',
'sort' => 1,
], [
'key' => 'marketing.email-marketing.email-templates.edit',
'name' => 'admin::app.acl.edit',
'route' => 'admin.email-templates.edit',
'sort' => 2,
], [
'key' => 'marketing.email-marketing.email-templates.delete',
'name' => 'admin::app.acl.delete',
'route' => 'admin.email-templates.delete',
'sort' => 3,
], [
'key' => 'marketing.email-marketing.events',
'name' => 'admin::app.acl.events',
'route' => 'admin.events.index',
'sort' => 1,
], [
'key' => 'marketing.email-marketing.events.create',
'name' => 'admin::app.acl.create',
'route' => 'admin.events.create',
'sort' => 1,
], [
'key' => 'marketing.email-marketing.events.edit',
'name' => 'admin::app.acl.edit',
'route' => 'admin.events.edit',
'sort' => 2,
], [
'key' => 'marketing.email-marketing.events.delete',
'name' => 'admin::app.acl.delete',
'route' => 'admin.events.delete',
'sort' => 3,
], [
'key' => 'marketing.email-marketing.campaigns',
'name' => 'admin::app.acl.campaigns',
'route' => 'admin.campaigns.index',
'sort' => 1,
], [
'key' => 'marketing.email-marketing.campaigns.create',
'name' => 'admin::app.acl.create',
'route' => 'admin.campaigns.create',
'sort' => 1,
], [
'key' => 'marketing.email-marketing.campaigns.edit',
'name' => 'admin::app.acl.edit',
'route' => 'admin.campaigns.edit',
'sort' => 2,
], [
'key' => 'marketing.email-marketing.campaigns.delete',
'name' => 'admin::app.acl.delete',
'route' => 'admin.campaigns.delete',
'sort' => 3,
], [
'key' => 'marketing.email-marketing.subscribers',
'name' => 'admin::app.acl.subscribers',
'route' => 'admin.customers.subscribers.index',
'sort' => 1,
], [
'key' => 'marketing.email-marketing.subscribers.edit',
'name' => 'admin::app.acl.edit',
'route' => 'admin.customers.subscribers.edit',
'sort' => 2,
], [
'key' => 'marketing.email-marketing.subscribers.delete',
'name' => 'admin::app.acl.delete',
'route' => 'admin.customers.subscribers.delete',
'sort' => 3,
],
/*
|--------------------------------------------------------------------------
| CMS
|--------------------------------------------------------------------------
|
| All ACLs related to cms will be placed here.
|
*/
[
'key' => 'cms',
'name' => 'admin::app.layouts.cms',
'route' => 'admin.cms.index',
'sort' => 7,
], [
'key' => 'cms.pages',
'name' => 'admin::app.cms.pages.pages',
'route' => 'admin.cms.index',
'sort' => 7,
], [
'key' => 'cms.pages.create',
'name' => 'admin::app.acl.create',
'route' => 'admin.cms.create',
'sort' => 1,
], [
'key' => 'cms.pages.edit',
'name' => 'admin::app.acl.edit',
'route' => 'admin.cms.edit',
'sort' => 2,
], [
'key' => 'cms.pages.delete',
'name' => 'admin::app.acl.delete',
'route' => 'admin.cms.delete',
'sort' => 3,
], [
'key' => 'cms.pages.mass-delete',
'name' => 'admin::app.acl.mass-delete',
'route' => 'admin.cms.mass-delete',
'sort' => 4,
],
/*
|--------------------------------------------------------------------------
| Settings
|--------------------------------------------------------------------------
|
| All ACLs related to settings will be placed here.
|
*/
[
'key' => 'settings',
'name' => 'admin::app.acl.settings',
'route' => 'admin.users.index',
'sort' => 6,
'sort' => 8,
], [
'key' => 'settings.locales',
'name' => 'admin::app.acl.locales',
@ -391,137 +735,20 @@ return [
'name' => 'admin::app.acl.delete',
'route' => 'admin.tax-rates.delete',
'sort' => 3,
], [
'key' => 'marketing',
'name' => 'admin::app.acl.marketing',
'route' => 'admin.cart-rules.index',
'sort' => 7,
], [
'key' => 'marketing.promotions',
'name' => 'admin::app.acl.promotions',
'route' => 'admin.cart-rules.index',
'sort' => 7,
], [
'key' => 'marketing.promotions.cart-rules',
'name' => 'admin::app.acl.cart-rules',
'route' => 'admin.cart-rules.index',
'sort' => 1,
], [
'key' => 'marketing.promotions.cart-rules.create',
'name' => 'admin::app.acl.create',
'route' => 'admin.cart-rules.create',
'sort' => 1,
], [
'key' => 'marketing.promotions.cart-rules.edit',
'name' => 'admin::app.acl.edit',
'route' => 'admin.cart-rules.edit',
'sort' => 2,
], [
'key' => 'marketing.promotions.cart-rules.delete',
'name' => 'admin::app.acl.delete',
'route' => 'admin.cart-rules.delete',
'sort' => 3,
], [
'key' => 'marketing.promotions.catalog-rules',
'name' => 'admin::app.acl.catalog-rules',
'route' => 'admin.catalog-rules.index',
'sort' => 1,
], [
'key' => 'marketing.promotions.catalog-rules.create',
'name' => 'admin::app.acl.create',
'route' => 'admin.catalog-rules.index',
'sort' => 1,
], [
'key' => 'marketing.promotions.catalog-rules.edit',
'name' => 'admin::app.acl.edit',
'route' => 'admin.catalog-rules.edit',
'sort' => 2,
], [
'key' => 'marketing.promotions.catalog-rules.delete',
'name' => 'admin::app.acl.delete',
'route' => 'admin.catalog-rules.delete',
'sort' => 3,
], [
'key' => 'marketing.email-marketing',
'name' => 'admin::app.acl.email-marketing',
'route' => 'admin.email-templates.index',
'sort' => 7,
], [
'key' => 'marketing.email-marketing.email-templates',
'name' => 'admin::app.acl.email-templates',
'route' => 'admin.email-templates.index',
'sort' => 1,
], [
'key' => 'marketing.email-marketing.email-templates.create',
'name' => 'admin::app.acl.create',
'route' => 'admin.email-templates.create',
'sort' => 1,
], [
'key' => 'marketing.email-marketing.email-templates.edit',
'name' => 'admin::app.acl.edit',
'route' => 'admin.email-templates.edit',
'sort' => 2,
], [
'key' => 'marketing.email-marketing.email-templates.delete',
'name' => 'admin::app.acl.delete',
'route' => 'admin.email-templates.delete',
'sort' => 3,
], [
'key' => 'marketing.email-marketing.events',
'name' => 'admin::app.acl.events',
'route' => 'admin.events.index',
'sort' => 1,
], [
'key' => 'marketing.email-marketing.events.create',
'name' => 'admin::app.acl.create',
'route' => 'admin.events.create',
'sort' => 1,
], [
'key' => 'marketing.email-marketing.events.edit',
'name' => 'admin::app.acl.edit',
'route' => 'admin.events.edit',
'sort' => 2,
], [
'key' => 'marketing.email-marketing.events.delete',
'name' => 'admin::app.acl.delete',
'route' => 'admin.events.delete',
'sort' => 3,
], [
'key' => 'marketing.email-marketing.campaigns',
'name' => 'admin::app.acl.campaigns',
'route' => 'admin.campaigns.index',
'sort' => 1,
], [
'key' => 'marketing.email-marketing.campaigns.create',
'name' => 'admin::app.acl.create',
'route' => 'admin.campaigns.create',
'sort' => 1,
], [
'key' => 'marketing.email-marketing.campaigns.edit',
'name' => 'admin::app.acl.edit',
'route' => 'admin.campaigns.edit',
'sort' => 2,
], [
'key' => 'marketing.email-marketing.campaigns.delete',
'name' => 'admin::app.acl.delete',
'route' => 'admin.campaigns.delete',
'sort' => 3,
], [
'key' => 'marketing.email-marketing.subscribers',
'name' => 'admin::app.acl.subscribers',
'route' => 'admin.subscribers.index',
'sort' => 1,
], [
'key' => 'marketing.email-marketing.subscribers.edit',
'name' => 'admin::app.acl.edit',
'route' => 'admin.subscribers.edit',
'sort' => 2,
], [
'key' => 'marketing.email-marketing.subscribers.delete',
'name' => 'admin::app.acl.delete',
'route' => 'admin.subscribers.delete',
'sort' => 3,
],
/*
|--------------------------------------------------------------------------
| Configuration
|--------------------------------------------------------------------------
|
| All ACLs related to configuration will be placed here.
|
*/
[
'key' => 'configuration',
'name' => 'admin::app.acl.configure',
'route' => 'admin.configuration.index',
'sort' => 9,
]
];
?>

View File

@ -98,7 +98,7 @@ class AddressDataGrid extends DataGrid
'sortable' => true,
'filterable' => true,
]);
$this->addColumn([
'index' => 'city',
'label' => trans('admin::app.customers.addresses.city'),
@ -167,7 +167,7 @@ class AddressDataGrid extends DataGrid
'type' => 'delete',
'label' => trans('admin::app.customers.addresses.delete'),
'action' => route('admin.customer.addresses.massdelete', request('id')),
'method' => 'DELETE',
'method' => 'POST',
]);
}
}

View File

@ -150,7 +150,7 @@ class AttributeDataGrid extends DataGrid
'action' => route('admin.catalog.attributes.massdelete'),
'label' => trans('admin::app.datagrid.delete'),
'index' => 'admin_name',
'method' => 'DELETE',
'method' => 'POST',
]);
}
}

View File

@ -78,7 +78,7 @@ class CMSPageDataGrid extends DataGrid
'type' => 'delete',
'label' => trans('admin::app.datagrid.delete'),
'action' => route('admin.cms.mass-delete'),
'method' => 'DELETE',
'method' => 'POST',
]);
}
}

View File

@ -12,7 +12,7 @@ class CartRuleCouponDataGrid extends DataGrid
protected $sortOrder = 'desc';
public function prepareQueryBuilder()
{
{
$route = request()->route() ? request()->route()->getName() : "" ;
$cartRuleId = $route == 'admin.cart-rules.edit' ? collect(request()->segments())->last() : last(explode("/", url()->previous()));
@ -20,7 +20,7 @@ class CartRuleCouponDataGrid extends DataGrid
$queryBuilder = DB::table('cart_rule_coupons')
->addSelect('id', 'code', 'created_at', 'expired_at', 'times_used')
->where('cart_rule_coupons.cart_rule_id', $cartRuleId);
$this->setQueryBuilder($queryBuilder);
}
@ -78,7 +78,7 @@ class CartRuleCouponDataGrid extends DataGrid
'type' => 'delete',
'action' => route('admin.cart-rule-coupons.mass-delete'),
'label' => trans('admin::app.datagrid.delete'),
'method' => 'DELETE',
'method' => 'POST',
]);
}
}

View File

@ -107,7 +107,7 @@ class CategoryDataGrid extends DataGrid
'type' => 'delete',
'label' => trans('admin::app.datagrid.delete'),
'action' => route('admin.catalog.categories.massdelete'),
'method' => 'DELETE',
'method' => 'POST',
]);
}
}

View File

@ -160,14 +160,14 @@ class CustomerDataGrid extends DataGrid
'type' => 'delete',
'label' => trans('admin::app.datagrid.delete'),
'action' => route('admin.customer.mass-delete'),
'method' => 'PUT',
'method' => 'POST',
]);
$this->addMassAction([
'type' => 'update',
'label' => trans('admin::app.datagrid.update-status'),
'action' => route('admin.customer.mass-update'),
'method' => 'PUT',
'method' => 'POST',
'options' => [
'Active' => 1,
'Inactive' => 0,

View File

@ -108,14 +108,14 @@ class CustomerReviewDataGrid extends DataGrid
'type' => 'delete',
'label' => trans('admin::app.datagrid.delete'),
'action' => route('admin.customer.review.massdelete'),
'method' => 'DELETE',
'method' => 'POST',
]);
$this->addMassAction([
'type' => 'update',
'label' => trans('admin::app.datagrid.update-status'),
'action' => route('admin.customer.review.massupdate'),
'method' => 'PUT',
'method' => 'POST',
'options' => [
trans('admin::app.customers.reviews.pending') => 0,
trans('admin::app.customers.reviews.approved') => 1,

View File

@ -223,14 +223,14 @@ class ProductDataGrid extends DataGrid
'type' => 'delete',
'label' => trans('admin::app.datagrid.delete'),
'action' => route('admin.catalog.products.massdelete'),
'method' => 'DELETE',
'method' => 'POST',
]);
$this->addMassAction([
'type' => 'update',
'label' => trans('admin::app.datagrid.update-status'),
'action' => route('admin.catalog.products.massupdate'),
'method' => 'PUT',
'method' => 'POST',
'options' => [
'Active' => 1,
'Inactive' => 0,

View File

@ -105,7 +105,7 @@ class TaxRateDataGrid extends DataGrid
$this->addAction([
'title' => trans('admin::app.datagrid.edit'),
'method' => 'GET',
'route' => 'admin.tax-rates.store',
'route' => 'admin.tax-rates.edit',
'icon' => 'icon pencil-lg-icon',
]);

View File

@ -341,7 +341,7 @@ Route::group(['middleware' => ['web', 'admin_locale']], function () {
])->name('admin.catalog.categories.massdelete');
Route::post('/categories/product/count', 'Webkul\Category\Http\Controllers\CategoryController@categoryProductCount')->name('admin.catalog.categories.product.count');
// Catalog Attribute Routes
Route::get('/attributes', 'Webkul\Attribute\Http\Controllers\AttributeController@index')->defaults('_config', [
@ -620,11 +620,11 @@ Route::group(['middleware' => ['web', 'admin_locale']], function () {
// tax category routes
Route::get('/tax-categories/create', 'Webkul\Tax\Http\Controllers\TaxCategoryController@show')->defaults('_config', [
'view' => 'admin::tax.tax-categories.create',
])->name('admin.tax-categories.show');
])->name('admin.tax-categories.create');
Route::post('/tax-categories/create', 'Webkul\Tax\Http\Controllers\TaxCategoryController@create')->defaults('_config', [
'redirect' => 'admin.tax-categories.index',
])->name('admin.tax-categories.create');
])->name('admin.tax-categories.store');
Route::get('/tax-categories/edit/{id}', 'Webkul\Tax\Http\Controllers\TaxCategoryController@edit')->defaults('_config', [
'view' => 'admin::tax.tax-categories.edit',
@ -645,15 +645,15 @@ Route::group(['middleware' => ['web', 'admin_locale']], function () {
Route::get('tax-rates/create', 'Webkul\Tax\Http\Controllers\TaxRateController@show')->defaults('_config', [
'view' => 'admin::tax.tax-rates.create',
])->name('admin.tax-rates.show');
])->name('admin.tax-rates.create');
Route::post('tax-rates/create', 'Webkul\Tax\Http\Controllers\TaxRateController@create')->defaults('_config', [
'redirect' => 'admin.tax-rates.index',
])->name('admin.tax-rates.create');
])->name('admin.tax-rates.store');
Route::get('tax-rates/edit/{id}', 'Webkul\Tax\Http\Controllers\TaxRateController@edit')->defaults('_config', [
'view' => 'admin::tax.tax-rates.edit',
])->name('admin.tax-rates.store');
])->name('admin.tax-rates.edit');
Route::put('tax-rates/update/{id}', 'Webkul\Tax\Http\Controllers\TaxRateController@update')->defaults('_config', [
'redirect' => 'admin.tax-rates.index',

View File

@ -87,15 +87,20 @@ return [
'acl' => [
'dashboard' => 'لوحة التحكم',
'sales' => 'المبيعات',
'cancel' => 'Cancel',
'orders' => 'الطلبات',
'shipments' => 'الشحنات',
'invoices' => 'الفواتير',
'refunds' => 'Refunds',
'catalog' => 'فهرس',
'products' => 'المنتجات',
'copy' => 'Copy',
'categories' => 'الفئات',
'attributes' => 'الصفات',
'attribute-families' => 'وصف الأسر',
'customers' => 'زبائن',
'addresses' => 'Addresses',
'note' => 'Note',
'groups' => 'المجموعات',
'reviews' => 'باء-الاستعراضات',
'newsletter-subscriptions' => 'الاشتراك في الرسالة الإخبارية',
@ -112,9 +117,12 @@ return [
'taxes' => 'الضرائب',
'tax-categories' => 'فئات الضرائب',
'tax-rates' => 'المعدلات الضريبية',
'view' => 'View',
'edit' => 'تعديل',
'create' => 'أضف',
'delete' => 'حذف',
'mass-delete' => 'Mass Delete',
'mass-update' => 'Mass Update',
'marketing' => 'Marketing',
'promotions' => 'الترقيات',
'cart-rules' => 'قواعد سلة التسوق',

View File

@ -86,15 +86,20 @@ return [
[
'dashboard' => 'Dashboard',
'sales' => 'Vertrieb',
'cancel' => 'Cancel',
'orders' => 'Bestellungen',
'shipments' => 'Sendungen',
'invoices' => 'Rechnungen',
'refunds' => 'Refunds',
'catalog' => 'Katalog',
'products' => 'Produkte',
'copy' => 'Copy',
'categories' => 'Kategorien',
'attributes' => 'Attribute',
'attribute-families' => 'Attributgruppen',
'customers' => 'Kunden',
'addresses' => 'Addresses',
'note' => 'Note',
'groups' => 'Gruppen',
'reviews' => 'Bewertungen',
'newsletter-subscriptions' => 'Newsletter-Abonnements',
@ -111,10 +116,13 @@ return [
'taxes' => 'Steuern',
'tax-categories' => 'Steuerkategorien',
'tax-rates' => 'Steuersätze',
'view' => 'View',
'edit' => 'Bearbeiten',
'create' => 'Hinzufügen',
'delete' => 'Löschen',
'marketing' => 'Marketing',
'mass-delete' => 'Mass Delete',
'mass-update' => 'Mass Update',
'marketing' => 'Marketing',
'promotions' => 'Promotions',
'cart-rules' => 'Warenkorbregeln',
'catalog-rules' => 'Katalogregeln',
@ -1197,7 +1205,7 @@ return [
'edit-error' => 'Can not edit this event.'
]
],
'error' =>
[
'go-to-home' => 'HOME ÖFFNEN',

View File

@ -88,15 +88,20 @@ return [
'acl' => [
'dashboard' => 'Dashboard',
'sales' => 'Sales',
'cancel' => 'Cancel',
'orders' => 'Orders',
'shipments' => 'Shipments',
'invoices' => 'Invoices',
'refunds' => 'Refunds',
'catalog' => 'Catalog',
'products' => 'Products',
'copy' => 'Copy',
'categories' => 'Categories',
'attributes' => 'Attributes',
'attribute-families' => 'Attribute Families',
'customers' => 'Customers',
'addresses' => 'Addresses',
'note' => 'Note',
'groups' => 'Groups',
'reviews' => 'Reviews',
'newsletter-subscriptions' => 'Newsletter Subscriptions',
@ -113,9 +118,12 @@ return [
'taxes' => 'Taxes',
'tax-categories' => 'Tax Categories',
'tax-rates' => 'Tax Rates',
'view' => 'View',
'edit' => 'Edit',
'create' => 'Add',
'delete' => 'Delete',
'mass-delete' => 'Mass Delete',
'mass-update' => 'Mass Update',
'marketing' => 'Marketing',
'promotions' => 'Promotions',
'cart-rules' => 'Cart Rules',

View File

@ -85,15 +85,20 @@ return [
'acl' => [
'dashboard' => 'Tablero',
'sales' => 'Ventas',
'cancel' => 'Cancel',
'orders' => 'Pedidos',
'shipments' => 'Envíos',
'invoices' => 'Facturas',
'refunds' => 'Refunds',
'catalog' => 'Catálogo',
'products' => 'Productos',
'copy' => 'Copy',
'categories' => 'Categorías',
'attributes' => 'Atributos',
'attribute-families' => 'Familias de atributos',
'customers' => 'Clientes',
'addresses' => 'Addresses',
'note' => 'Note',
'groups' => 'Grupos',
'reviews' => 'Opiniones',
'newsletter-subscriptions' => 'Suscripciones a newsletter por correo',
@ -110,9 +115,12 @@ return [
'taxes' => 'Impuestos',
'tax-categories' => 'Categorías de impuestos',
'tax-rates' => 'Tasas de impuestos',
'view' => 'View',
'edit' => 'Editar',
'create' => 'Agregar',
'delete' => 'Borrar',
'mass-delete' => 'Mass Delete',
'mass-update' => 'Mass Update',
'marketing' => 'Marketing',
'promotions' => 'Promociones',
'cart-rules' => 'Reglas del carrito',

View File

@ -86,15 +86,20 @@ return [
'acl' => [
'dashboard' => 'داشبورد',
'sales' => 'فروش',
'cancel' => 'Cancel',
'orders' => 'سفارشات',
'shipments' => 'حمل و نقل',
'invoices' => 'صورت حساب',
'refunds' => 'Refunds',
'catalog' => 'کاتالوگ',
'products' => 'محصولات',
'copy' => 'Copy',
'categories' => 'دسته بندی ها',
'attributes' => 'ویژگی ها',
'attribute-families' => 'ویژگی خانواده',
'customers' => 'مشتریان',
'addresses' => 'Addresses',
'note' => 'Note',
'groups' => 'گروه ها',
'reviews' => 'بررسی ها',
'newsletter-subscriptions' => 'اشتراک های خبرنامه',
@ -111,9 +116,12 @@ return [
'taxes' => 'مالیات',
'tax-categories' => 'دسته بندی مالیات',
'tax-rates' => 'نرخ مالیات',
'view' => 'View',
'edit' => 'ویاریش',
'create' => 'افزودن',
'delete' => 'حذف',
'mass-delete' => 'Mass Delete',
'mass-update' => 'Mass Update',
'marketing' => 'Marketing',
'promotions' => 'تبلیغات',
'cart-rules' => 'قوانین سبد خرید',

View File

@ -86,15 +86,20 @@ return [
'acl' => [
'dashboard' => 'Dashboard',
'sales' => 'Vendite',
'cancel' => 'Cancel',
'orders' => 'Ordini',
'shipments' => 'Spedizioni',
'invoices' => 'Fatture',
'refunds' => 'Refunds',
'catalog' => 'Catalogo',
'products' => 'Prodotti',
'copy' => 'Copy',
'categories' => 'Categorie',
'attributes' => 'Attributi',
'attribute-families' => 'Famiglie Attributi',
'customers' => 'Clienti',
'addresses' => 'Addresses',
'note' => 'Note',
'groups' => 'Gruppi',
'reviews' => 'Recensioni',
'newsletter-subscriptions' => 'Iscrizioni Newsletter',
@ -111,9 +116,12 @@ return [
'taxes' => 'IVA',
'tax-categories' => 'Categorie IVA',
'tax-rates' => 'Aliquote IVA',
'view' => 'View',
'edit' => 'Modifica',
'create' => 'Aggiungi',
'delete' => 'Elimina',
'mass-delete' => 'Mass Delete',
'mass-update' => 'Mass Update',
'marketing' => 'Marketing',
'promotions' => 'Promozioni',
'cart-rules' => 'Regole Carrello',

View File

@ -86,15 +86,20 @@ return [
'acl' => [
'dashboard' => 'Dashboard',
'sales' => 'Verkopen',
'cancel' => 'Cancel',
'orders' => 'Bestellingen',
'shipments' => 'Verzendingen',
'invoices' => 'Facturen',
'refunds' => 'Refunds',
'catalog' => 'Catalogus',
'products' => 'Producten',
'copy' => 'Copy',
'categories' => 'Categorieën',
'attributes' => 'Attributes',
'attribute-families' => 'Attribute Families',
'customers' => 'Klanten',
'addresses' => 'Addresses',
'note' => 'Note',
'groups' => 'Groepen',
'reviews' => 'Reviews',
'newsletter-subscriptions' => 'Newsletter Subscriptions',
@ -111,9 +116,12 @@ return [
'taxes' => 'Belastingen',
'tax-categories' => 'Belasting categorieën',
'tax-rates' => 'BTW-tarieven',
'view' => 'View',
'edit' => 'Edit',
'create' => 'Add',
'delete' => 'Verwijder',
'mass-delete' => 'Mass Delete',
'mass-update' => 'Mass Update',
'marketing' => 'Marketing',
'promotions' => 'Promoties',
'cart-rules' => 'Cart Rules',

View File

@ -85,15 +85,20 @@ return [
'acl' => [
'dashboard' => 'Kokpit',
'sales' => 'Sprzedaż',
'cancel' => 'Cancel',
'orders' => 'Zamówienia',
'shipments' => 'przesyłki',
'invoices' => 'Faktury',
'refunds' => 'Refunds',
'catalog' => 'Katalog',
'products' => 'Produkty',
'copy' => 'Copy',
'categories' => 'Kategorie',
'attributes' => 'Atrybuty',
'attribute-families' => 'Rodziny atrybutów',
'customers' => 'Klienci',
'addresses' => 'Addresses',
'note' => 'Note',
'groups' => 'Grupy',
'reviews' => 'Recenzje',
'newsletter-subscriptions' => 'Subskrypcje newslettera',
@ -110,9 +115,12 @@ return [
'taxes' => 'Podatki',
'tax-categories' => 'Kategorie podatkowe',
'tax-rates' => 'Stawki podatkowe',
'view' => 'View',
'edit' => 'Edytuj',
'create' => 'Dodaj',
'delete' => 'Usuń',
'mass-delete' => 'Mass Delete',
'mass-update' => 'Mass Update',
'marketing' => 'Marketing',
'promotions' => 'Promocje',
'cart-rules' => 'Zasady koszyka',

View File

@ -86,15 +86,20 @@ return [
'acl' => [
'dashboard' => 'Dashboard',
'sales' => 'Vendas',
'cancel' => 'Cancel',
'orders' => 'Pedidos',
'shipments' => 'Envios',
'invoices' => 'Faturas',
'refunds' => 'Refunds',
'catalog' => 'Catálogos',
'products' => 'Produtos',
'copy' => 'Copy',
'categories' => 'Categorias',
'attributes' => 'Atributos',
'attribute-families' => 'Famílias de Atributos',
'customers' => 'Clientes',
'addresses' => 'Addresses',
'note' => 'Note',
'groups' => 'Grupos',
'reviews' => 'Avaliações',
'newsletter-subscriptions' => 'Inscrições de Newsletter',
@ -111,9 +116,12 @@ return [
'taxes' => 'Impostos',
'tax-categories' => 'Categorias de Impostos',
'tax-rates' => 'Impostos de Impostos',
'view' => 'View',
'edit' => 'Edit',
'create' => 'Add',
'delete' => 'Delete',
'mass-delete' => 'Mass Delete',
'mass-update' => 'Mass Update',
'marketing' => 'Marketing',
'promotions' => 'Promoções',
'cart-rules' => 'Regras do Carrinho',

View File

@ -84,15 +84,20 @@ return [
'acl' => [
'dashboard' => 'Panel',
'sales' => 'Satışlar',
'cancel' => 'Cancel',
'orders' => 'Siparişler',
'shipments' => 'Teslimatlar',
'invoices' => 'Faturalar',
'refunds' => 'Refunds',
'catalog' => 'Katalog',
'products' => 'Ürünler',
'copy' => 'Copy',
'categories' => 'Kategoriler',
'attributes' => 'Nitelikler',
'attribute-families' => 'Nitelik Grupları',
'customers' => 'Müşteriler',
'addresses' => 'Addresses',
'note' => 'Note',
'groups' => 'Gruplar',
'reviews' => 'İncelemeler',
'newsletter-subscriptions' => 'Bülten Üyelikleri',
@ -109,9 +114,12 @@ return [
'taxes' => 'Vergi',
'tax-categories' => 'Vergi Grupları',
'tax-rates' => 'Vergi Oranları',
'view' => 'View',
'edit' => 'Düzenle',
'create' => 'Oluştur',
'delete' => 'Sil',
'mass-delete' => 'Mass Delete',
'mass-update' => 'Mass Update',
'marketing' => 'Marketing',
'promotions' => 'Promosyonlar',
'cart-rules' => 'Alışveriş Sepeti Kuralları',

View File

@ -25,7 +25,7 @@
<div class="page-action">
{!! view_render_event('sales.order.page_action.before', ['order' => $order]) !!}
@if ($order->canCancel())
@if ($order->canCancel() && bouncer()->hasPermission('sales.orders.cancel'))
<a href="{{ route('admin.sales.orders.cancel', $order->id) }}" class="btn btn-lg btn-primary" v-alert:message="'{{ __('admin::app.sales.orders.cancel-confirm-msg') }}'">
{{ __('admin::app.sales.orders.cancel-btn-title') }}
</a>

View File

@ -6,7 +6,7 @@
@section('content')
<div class="content">
<form method="POST" action="{{ route('admin.tax-categories.create') }}" @submit.prevent="onSubmit">
<form method="POST" action="{{ route('admin.tax-categories.store') }}" @submit.prevent="onSubmit">
<div class="page-header">
<div class="page-title">
<h1>

View File

@ -12,7 +12,7 @@
</div>
<div class="page-action">
<a href="{{ route('admin.tax-categories.show') }}" class="btn btn-lg btn-primary">
<a href="{{ route('admin.tax-categories.create') }}" class="btn btn-lg btn-primary">
{{ __('admin::app.settings.tax-categories.add-title') }}
</a>
</div>

View File

@ -6,7 +6,7 @@
@section('content')
<div class="content">
<form method="POST" action="{{ route('admin.tax-rates.create') }}" @submit.prevent="onSubmit">
<form method="POST" action="{{ route('admin.tax-rates.store') }}" @submit.prevent="onSubmit">
<div class="page-header">
<div class="page-title">
<h1>

View File

@ -25,7 +25,7 @@
</span>
</div>
<a href="{{ route('admin.tax-rates.show') }}" class="btn btn-lg btn-primary">
<a href="{{ route('admin.tax-rates.create') }}" class="btn btn-lg btn-primary">
{{ __('admin::app.settings.tax-rates.add-title') }}
</a>
</div>

View File

@ -7,14 +7,14 @@ use Illuminate\Support\Facades\Event;
abstract class DataGrid
{
/**
* set index columns, ex: id.
* Set index columns, ex: id.
*
* @var int
*/
protected $index;
/**
* Default sort order of datagrid
* Default sort order of datagrid.
*
* @var string
*/
@ -29,14 +29,14 @@ abstract class DataGrid
protected $enableFilterMap = false;
/**
* This is array where aliases and custom column's name are passed
* This is array where aliases and custom column's name are passed.
*
* @var array
*/
protected $filterMap = [];
/**
* array to hold all the columns which will be displayed on frontend.
* Array to hold all the columns which will be displayed on frontend.
*
* @var array
*/
@ -44,13 +44,15 @@ abstract class DataGrid
/**
* Complete column details.
*
* @var array
*/
protected $completeColumnDetails = [];
/**
* Hold query builder instance of the query prepared by executing datagrid
* class method setQueryBuilder
* class method `setQueryBuilder`.
*
* @var array
*/
@ -80,7 +82,7 @@ abstract class DataGrid
protected $massActions = [];
/**
* Parsed value of the url parameters
* Parsed value of the url parameters.
*
* @var array
*/
@ -99,7 +101,7 @@ abstract class DataGrid
protected $enableAction = false;
/**
* paginate the collection or not
* Paginate the collection or not.
*
* @var bool
*/
@ -113,70 +115,91 @@ abstract class DataGrid
protected $itemsPerPage = 10;
/**
* Operators mapping.
*
* @var array
*/
protected $operators = [
'eq' => "=",
'lt' => "<",
'gt' => ">",
'lte' => "<=",
'gte' => ">=",
'neqs' => "<>",
'neqn' => "!=",
'eqo' => "<=>",
'like' => "like",
'blike' => "like binary",
'nlike' => "not like",
'ilike' => "ilike",
'and' => "&",
'bor' => "|",
'regex' => "regexp",
'notregex' => "not regexp",
'eq' => '=',
'lt' => '<',
'gt' => '>',
'lte' => '<=',
'gte' => '>=',
'neqs' => '<>',
'neqn' => '!=',
'eqo' => '<=>',
'like' => 'like',
'blike' => 'like binary',
'nlike' => 'not like',
'ilike' => 'ilike',
'and' => '&',
'bor' => '|',
'regex' => 'regexp',
'notregex' => 'not regexp',
];
/**
* Bindings.
*
* @var array
*/
protected $bindings = [
0 => "select",
1 => "from",
2 => "join",
3 => "where",
4 => "having",
5 => "order",
6 => "union",
0 => 'select',
1 => 'from',
2 => 'join',
3 => 'where',
4 => 'having',
5 => 'order',
6 => 'union',
];
/**
* Select components.
*
* @var array
*/
protected $selectcomponents = [
0 => "aggregate",
1 => "columns",
2 => "from",
3 => "joins",
4 => "wheres",
5 => "groups",
6 => "havings",
7 => "orders",
8 => "limit",
9 => "offset",
10 => "lock",
0 => 'aggregate',
1 => 'columns',
2 => 'from',
3 => 'joins',
4 => 'wheres',
5 => 'groups',
6 => 'havings',
7 => 'orders',
8 => 'limit',
9 => 'offset',
10 => 'lock',
];
/** @var string[] contains the keys for which extra filters to show */
/**
* Contains the keys for which extra filters to show.
*
* @var string[]
*/
protected $extraFilters = [];
/**
* The current admin user.
*
* @var object
*/
protected $currentUser;
abstract public function prepareQueryBuilder();
abstract public function addColumns();
/**
* Create datagrid instance.
*
* @return void
*/
public function __construct()
{
$this->invoker = $this;
$this->currentUser = auth()->guard('admin')->user();
}
/**
@ -189,7 +212,7 @@ abstract class DataGrid
$parsedUrl = [];
$unparsed = url()->full();
$route = request()->route() ? request()->route()->getName() : "";
$route = request()->route() ? request()->route()->getName() : '';
if ($route == 'admin.datagrid.export') {
$unparsed = url()->previous();
@ -218,7 +241,7 @@ abstract class DataGrid
}
/**
* Add the index as alias of the column and use the column to make things happen
* Add the index as alias of the column and use the column to make things happen.
*
* @param string $alias
* @param string $column
@ -233,6 +256,8 @@ abstract class DataGrid
}
/**
* Add column.
*
* @param string $column
*
* @return void
@ -249,6 +274,8 @@ abstract class DataGrid
}
/**
* Set complete column details.
*
* @param string $column
*
* @return void
@ -259,6 +286,8 @@ abstract class DataGrid
}
/**
* Set query builder.
*
* @param \Illuminate\Database\Query\Builder $queryBuilder
*
* @return void
@ -269,12 +298,16 @@ abstract class DataGrid
}
/**
* Add action.
*
* @param array $action
*
* @return void
*/
public function addAction($action)
{
$currentRouteACL = $this->fetchCurrentRouteACL($action);
if (isset($action['title'])) {
$eventName = strtolower($action['title']);
$eventName = explode(' ', $eventName);
@ -283,22 +316,29 @@ abstract class DataGrid
$eventName = null;
}
$this->fireEvent('action.before.' . $eventName);
if (bouncer()->hasPermission($currentRouteACL['key'] ?? null)) {
$this->fireEvent('action.before.' . $eventName);
array_push($this->actions, $action);
array_push($this->actions, $action);
$this->enableAction = true;
$this->enableAction = true;
$this->fireEvent('action.after.' . $eventName);
$this->fireEvent('action.after.' . $eventName);
}
}
/**
* Add mass action.
*
* @param array $massAction
*
* @return void
*/
public function addMassAction($massAction)
{
$massAction['route'] = $this->getRouteNameFromUrl($massAction['action'], $massAction['method']);
$currentRouteACL = $this->fetchCurrentRouteACL($massAction);
if (isset($massAction['label'])) {
$eventName = strtolower($massAction['label']);
$eventName = explode(' ', $eventName);
@ -307,16 +347,19 @@ abstract class DataGrid
$eventName = null;
}
$this->fireEvent('mass.action.before.' . $eventName);
if (bouncer()->hasPermission($currentRouteACL['key'] ?? null)) {
$this->fireEvent('mass.action.before.' . $eventName);
$this->massActions[] = $massAction;
$this->massActions[] = $massAction;
$this->enableMassAction = true;
$this->enableMassAction = true;
$this->fireEvent('mass.action.after.' . $eventName);
$this->fireEvent('mass.action.after.' . $eventName);
}
}
/**
* Get collections.
*
* @return \Illuminate\Support\Collection
*/
public function getCollection()
@ -376,6 +419,8 @@ abstract class DataGrid
}
/**
* Sort or filter collection.
*
* @param \Illuminate\Support\Collection $collection
* @param array $parseInfo
*
@ -387,7 +432,7 @@ abstract class DataGrid
$columnType = $this->findColumnType($key)[0] ?? null;
$columnName = $this->findColumnType($key)[1] ?? null;
if ($key === "sort") {
if ($key === 'sort') {
$count_keys = count(array_keys($info));
if ($count_keys > 1) {
@ -400,7 +445,7 @@ abstract class DataGrid
$columnName[1],
array_values($info)[0]
);
} elseif ($key === "search") {
} elseif ($key === 'search') {
$count_keys = count(array_keys($info));
if ($count_keys > 1) {
@ -430,7 +475,7 @@ abstract class DataGrid
}
}
if (array_keys($info)[0] === "like" || array_keys($info)[0] === "nlike") {
if (array_keys($info)[0] === 'like' || array_keys($info)[0] === 'nlike') {
foreach ($info as $condition => $filter_value) {
if ($this->enableFilterMap && isset($this->filterMap[$columnName])) {
$collection->where(
@ -526,7 +571,7 @@ abstract class DataGrid
);
});
}
} elseif ($this->enableFilterMap && ! isset($this->filterMap[$columnName])) {
} elseif ($this->enableFilterMap && ! isset($this->filterMap[$columnName])) {
if ($this->operators[$condition] == '=') {
if ($filter_value == 1) {
$collection->Where(function($query) use($columnName, $condition, $filter_value) {
@ -649,6 +694,8 @@ abstract class DataGrid
}
/**
* Trigger event.
*
* @param string $name
*
* @return void
@ -658,7 +705,7 @@ abstract class DataGrid
if (isset($name)) {
$className = get_class($this->invoker);
$className = last(explode("\\", $className));
$className = last(explode('\\', $className));
$className = strtolower($className);
@ -669,6 +716,8 @@ abstract class DataGrid
}
/**
* Preprare mass actions.
*
* @return void
*/
public function prepareMassActions()
@ -676,6 +725,8 @@ abstract class DataGrid
}
/**
* Prepare actions.
*
* @return void
*/
public function prepareActions()
@ -683,6 +734,8 @@ abstract class DataGrid
}
/**
* Render view.
*
* @return \Illuminate\View\View
*/
public function render()
@ -722,6 +775,8 @@ abstract class DataGrid
}
/**
* Export.
*
* @return \Illuminate\Support\Collection
*/
public function export()
@ -738,4 +793,33 @@ abstract class DataGrid
return $this->getCollection();
}
/**
* Fetch current route acl. As no access to acl key, this will fetch acl by route name.
*
* @param $action
*
* @return array
*/
private function fetchCurrentRouteACL($action)
{
return collect(config('acl'))->filter(function ($acl) use ($action) {
return $acl['route'] === $action['route'];
})->first();
}
/**
* Fetch route name from full url, not the current one.
*
* @param $action
*
* @return array
*/
private function getRouteNameFromUrl($action, $method)
{
return app('router')->getRoutes()
->match(app('request')
->create(str_replace(config('app.url'), '', $action), $method))
->getName();
}
}

View File

@ -0,0 +1,44 @@
<?php
return [
[
'key' => 'velocity',
'name' => 'velocity::app.admin.layouts.velocity',
'route' => 'velocity.admin.meta-data',
'sort' => 5,
],
[
'key' => 'velocity.meta-data',
'name' => 'velocity::app.admin.layouts.meta-data',
'route' => 'velocity.admin.meta-data',
'sort' => 5,
],
[
'key' => 'velocity.meta-data.edit',
'name' => 'admin::app.acl.edit',
'route' => 'velocity.admin.store.meta-data',
'sort' => 1,
],
[
'key' => 'velocity.header',
'name' => 'velocity::app.admin.layouts.header-content',
'route' => 'velocity.admin.content.index',
'sort' => 5,
],
[
'key' => 'velocity.header.create',
'name' => 'admin::app.acl.create',
'route' => 'velocity.admin.content.create',
'sort' => 1,
], [
'key' => 'velocity.header.edit',
'name' => 'admin::app.acl.edit',
'route' => 'velocity.admin.content.edit',
'sort' => 2,
], [
'key' => 'velocity.header.delete',
'name' => 'admin::app.acl.delete',
'route' => 'velocity.admin.content.delete',
'sort' => 3,
]
];

View File

@ -104,7 +104,7 @@ class CategoryDataGrid extends DataGrid
'type' => 'delete',
'action' => route('velocity.admin.category.mass-delete'),
'label' => trans('admin::app.datagrid.delete'),
'method' => 'DELETE',
'method' => 'POST',
]);
}
}

View File

@ -116,7 +116,7 @@ class ContentDataGrid extends DataGrid
'type' => 'delete',
'action' => route('velocity.admin.content.mass-delete'),
'label' => trans('admin::app.datagrid.delete'),
'method' => 'DELETE',
'method' => 'POST',
]);
}
}

View File

@ -57,6 +57,10 @@ class VelocityServiceProvider extends ServiceProvider
$this->mergeConfigFrom(
dirname(__DIR__) . '/Config/admin-menu.php', 'menu.admin'
);
$this->mergeConfigFrom(
dirname(__DIR__) . '/Config/acl.php', 'acl'
);
}
/**