Attribute Package Added

This commit is contained in:
jitendra 2018-07-11 11:11:27 +05:30
parent 97b1cf0d0e
commit 30a5784d75
71 changed files with 1991 additions and 92 deletions

View File

@ -6,10 +6,12 @@
"type": "project",
"require": {
"php": "^7.1.3",
"dimsav/laravel-translatable": "^9.0",
"fideloper/proxy": "^4.0",
"laravel/framework": "5.6.*",
"laravel/tinker": "^1.0",
"nwidart/laravel-modules": "^3.2"
"nwidart/laravel-modules": "^3.2",
"propaganistas/laravel-intl": "^2.0"
},
"require-dev": {
"barryvdh/laravel-debugbar": "^3.1",
@ -22,7 +24,9 @@
"replace": {
"webkul/laravel-user": "self.version",
"webkul/laravel-admin": "self.version",
"webkul/laravel-ui": "self.version"
"webkul/laravel-ui": "self.version",
"webkul/laravel-core": "self.version",
"webkul/laravel-attribute": "self.version"
},
"autoload": {
"classmap": [
@ -33,7 +37,9 @@
"App\\": "app/",
"Webkul\\User\\": "packages/Webkul/User/src",
"Webkul\\Admin\\": "packages/Webkul/Admin/src",
"Webkul\\Ui\\": "packages/Webkul/Ui/src"
"Webkul\\Ui\\": "packages/Webkul/Ui/src",
"Webkul\\Attribute\\": "packages/Webkul/Attribute/src",
"Webkul\\Core\\": "packages/Webkul/Core/src"
}
},
"autoload-dev": {

375
composer.lock generated
View File

@ -4,8 +4,107 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "5d86c298bb279ec35bcbbd1dfb204831",
"content-hash": "1cfe5a0cb070df958cccb486627d42f2",
"packages": [
{
"name": "commerceguys/intl",
"version": "v1.0.1",
"source": {
"type": "git",
"url": "https://github.com/commerceguys/intl.git",
"reference": "22156e447530d6ebd387bfee51ef1ae2c70a5ff0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/commerceguys/intl/zipball/22156e447530d6ebd387bfee51ef1ae2c70a5ff0",
"reference": "22156e447530d6ebd387bfee51ef1ae2c70a5ff0",
"shasum": ""
},
"require": {
"php": ">=5.5.0"
},
"require-dev": {
"mikey179/vfsstream": "1.*",
"phpunit/phpunit": "~4.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.x-dev"
}
},
"autoload": {
"psr-4": {
"CommerceGuys\\Intl\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Bojan Zivanovic"
}
],
"description": "Internationalization library powered by CLDR data.",
"time": "2018-06-21T14:03:04+00:00"
},
{
"name": "dimsav/laravel-translatable",
"version": "v9.0",
"source": {
"type": "git",
"url": "https://github.com/dimsav/laravel-translatable.git",
"reference": "a174b327342e882df7df9d971cf36ae678c16088"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/dimsav/laravel-translatable/zipball/a174b327342e882df7df9d971cf36ae678c16088",
"reference": "a174b327342e882df7df9d971cf36ae678c16088",
"shasum": ""
},
"require": {
"illuminate/support": "5.6.*",
"php": ">=5.4.0"
},
"require-dev": {
"orchestra/testbench": "3.6.*",
"phpunit/phpunit": "~7.0"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"Dimsav\\Translatable\\TranslatableServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"Dimsav\\Translatable\\": "src/Translatable/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Dimitrios Savvopoulos",
"email": "ds@dimsav.com",
"homepage": "http://dimsav.com"
}
],
"description": "A Laravel package for multilingual models",
"keywords": [
"database",
"language",
"laravel",
"translation"
],
"time": "2018-02-10T14:10:41+00:00"
},
{
"name": "dnoegel/php-xdg-base-dir",
"version": "0.1",
@ -453,6 +552,71 @@
],
"time": "2015-04-20T18:58:01+00:00"
},
{
"name": "jenssegers/date",
"version": "v3.4.0",
"source": {
"type": "git",
"url": "https://github.com/jenssegers/date.git",
"reference": "3f5f94f28bd5108fab011869434209101d4189ae"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/jenssegers/date/zipball/3f5f94f28bd5108fab011869434209101d4189ae",
"reference": "3f5f94f28bd5108fab011869434209101d4189ae",
"shasum": ""
},
"require": {
"nesbot/carbon": "^1.0",
"php": ">=5.6",
"symfony/translation": "^2.7|^3.0|^4.0"
},
"require-dev": {
"phpunit/phpunit": "^5.0|^6.0|^7.0",
"satooshi/php-coveralls": "^2.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.1-dev"
},
"laravel": {
"providers": [
"Jenssegers\\Date\\DateServiceProvider"
],
"aliases": {
"Date": "Jenssegers\\Date\\Date"
}
}
},
"autoload": {
"psr-4": {
"Jenssegers\\Date\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jens Segers",
"homepage": "https://jenssegers.com"
}
],
"description": "A date library to help you work with dates in different languages",
"homepage": "https://github.com/jenssegers/date",
"keywords": [
"carbon",
"date",
"datetime",
"i18n",
"laravel",
"time",
"translation"
],
"time": "2018-05-16T11:53:55+00:00"
},
{
"name": "laravel/framework",
"version": "v5.6.24",
@ -1040,6 +1204,69 @@
],
"time": "2018-06-08T15:26:40+00:00"
},
{
"name": "propaganistas/laravel-intl",
"version": "2.0.3",
"source": {
"type": "git",
"url": "https://github.com/Propaganistas/Laravel-Intl.git",
"reference": "645a34430ae92d287e97a06815d613be1f3002b5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Propaganistas/Laravel-Intl/zipball/645a34430ae92d287e97a06815d613be1f3002b5",
"reference": "645a34430ae92d287e97a06815d613be1f3002b5",
"shasum": ""
},
"require": {
"commerceguys/intl": "^1.0.1",
"illuminate/support": ">=5.1,<5.7",
"jenssegers/date": "^3.2.3",
"php": ">=7.0",
"punic/punic": "^3.1",
"umpirsky/country-list": "^2.0",
"umpirsky/locale-list": "^1.0"
},
"require-dev": {
"orchestra/testbench": ">=3.1",
"phpunit/phpunit": "^5.0|^6.0|^7.0"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"Propaganistas\\LaravelIntl\\IntlServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"Propaganistas\\LaravelIntl\\": "src/"
},
"files": [
"src/helpers.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Propaganistas",
"email": "Propaganistas@users.noreply.github.com"
}
],
"description": "Easy to use internationalization functions for Laravel",
"keywords": [
"i18n",
"internationalization",
"intl",
"l10n",
"laravel"
],
"time": "2018-07-03T07:55:17+00:00"
},
{
"name": "psr/container",
"version": "1.0.0",
@ -1256,6 +1483,75 @@
],
"time": "2018-06-10T17:57:20+00:00"
},
{
"name": "punic/punic",
"version": "3.1.0",
"source": {
"type": "git",
"url": "https://github.com/punic/punic.git",
"reference": "bd49ff54ea6ee8a902a567905664ecc7840037d6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/punic/punic/zipball/bd49ff54ea6ee8a902a567905664ecc7840037d6",
"reference": "bd49ff54ea6ee8a902a567905664ecc7840037d6",
"shasum": ""
},
"require": {
"php": ">=5.3"
},
"replace": {
"punic/calendar": "*",
"punic/common": "*"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "2.2.*",
"phpunit/phpunit": "^4"
},
"bin": [
"bin/punic-data"
],
"type": "library",
"autoload": {
"psr-4": {
"Punic\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Michele Locati",
"email": "mlocati@gmail.com",
"role": "Developer"
},
{
"name": "Remo Laubacher",
"email": "remo.laubacher@gmail.com",
"role": "Collaborator, motivator and perfectionist supporter"
}
],
"description": "PHP-Unicode CLDR",
"homepage": "https://github.com/punic/punic",
"keywords": [
"calendar",
"cldr",
"date",
"date-time",
"i18n",
"internationalization",
"l10n",
"localization",
"php",
"time",
"translate",
"translations",
"unicode"
],
"time": "2018-02-09T15:54:34+00:00"
},
{
"name": "ramsey/uuid",
"version": "3.7.3",
@ -2308,6 +2604,83 @@
"homepage": "https://github.com/tijsverkoyen/CssToInlineStyles",
"time": "2017-11-27T11:13:29+00:00"
},
{
"name": "umpirsky/country-list",
"version": "2.0.4",
"source": {
"type": "git",
"url": "https://github.com/umpirsky/country-list.git",
"reference": "ddabf3a8ef2956fc0fbd22da9bec642ab6cfdede"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/umpirsky/country-list/zipball/ddabf3a8ef2956fc0fbd22da9bec642ab6cfdede",
"reference": "ddabf3a8ef2956fc0fbd22da9bec642ab6cfdede",
"shasum": ""
},
"require": {
"php": "^7.0"
},
"require-dev": {
"slowprog/composer-copy-file": "^0.2",
"symfony/locale": "^2.7|^3.0",
"umpirsky/list-generator": "^1.2"
},
"type": "library",
"extra": {
"copy-file": {
"vendor/umpirsky/list-generator/Dockerfile": "./",
"vendor/umpirsky/list-generator/docker-compose.yml": "./"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Saša Stamenković",
"email": "umpirsky@gmail.com"
}
],
"description": "List of all countries with names and ISO 3166-1 codes in all languages and data formats.",
"time": "2018-02-27T18:55:19+00:00"
},
{
"name": "umpirsky/locale-list",
"version": "1.0.0",
"source": {
"type": "git",
"url": "https://github.com/umpirsky/locale-list.git",
"reference": "8141f749e16e568a5a9f7e813c50f72efa794c2e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/umpirsky/locale-list/zipball/8141f749e16e568a5a9f7e813c50f72efa794c2e",
"reference": "8141f749e16e568a5a9f7e813c50f72efa794c2e",
"shasum": ""
},
"require": {
"php": ">=5.4"
},
"require-dev": {
"symfony/locale": "^2.7|^3.0",
"umpirsky/list-generator": "^1.1"
},
"type": "library",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Saša Stamenković",
"email": "umpirsky@gmail.com"
}
],
"description": "List of all locales with names and codes in all languages and all data formats.",
"time": "2018-06-01T17:50:07+00:00"
},
{
"name": "vlucas/phpdotenv",
"version": "v2.4.0",

View File

@ -151,6 +151,9 @@ return [
* Package Service Providers...
*/
Dimsav\Translatable\TranslatableServiceProvider::class,
Propaganistas\LaravelIntl\IntlServiceProvider::class,
/*
* Application Service Providers...
*/
@ -163,7 +166,9 @@ return [
Webkul\User\Providers\UserServiceProvider::class,
Webkul\Admin\Providers\AdminServiceProvider::class,
Webkul\Ui\Providers\UiServiceProvider::class
Webkul\Ui\Providers\UiServiceProvider::class,
Webkul\Attribute\Providers\AttributeServiceProvider::class,
Webkul\Core\Providers\CoreServiceProvider::class
],
/*

View File

@ -9,7 +9,8 @@
],
"require": {
"webkul/laravel-user": "dev-master",
"webkul/laravel-ui": "dev-master"
"webkul/laravel-ui": "dev-master",
"webkul/laravel-core": "dev-master"
},
"autoload": {
"psr-4": {

View File

@ -36,9 +36,28 @@ Route::group(['middleware' => ['web']], function () {
Route::get('/logout', 'Webkul\User\Http\Controllers\SessionController@destroy')->defaults('_config', [
'redirect' => 'admin.session.create'
])->name('admin.session.destroy');
// Dashboard Route
Route::get('/dashboard', 'Webkul\Admin\Http\Controllers\DashboardController@index')->name('admin.dashboard.index');
// Catalog Routes
Route::prefix('catalog')->group(function () {
Route::get('/attributes', 'Webkul\Attribute\Http\Controllers\AttributeController@index')->defaults('_config', [
'view' => 'admin::catalog.attributes.index'
])->name('admin.catalog.attributes.index');
Route::get('/attributes/create', 'Webkul\Attribute\Http\Controllers\AttributeController@create')->defaults('_config', [
'view' => 'admin::catalog.attributes.create'
])->name('admin.catalog.attributes.create');
Route::post('/attributes/create', 'Webkul\Attribute\Http\Controllers\AttributeController@store')->defaults('_config', [
'redirect' => 'admin.catalog.attributes.index'
])->name('admin.catalog.attributes.store');
});
// User Routes
Route::get('/users', 'Webkul\User\Http\Controllers\UserController@index')->defaults('_config', [
'view' => 'admin::users.users.index'
@ -60,6 +79,7 @@ Route::group(['middleware' => ['web']], function () {
'redirect' => 'admin.users.index'
])->name('admin.users.update');
// User Role Routes
Route::get('/roles', 'Webkul\User\Http\Controllers\RoleController@index')->defaults('_config', [
'view' => 'admin::users.roles.index'
@ -82,6 +102,20 @@ Route::group(['middleware' => ['web']], function () {
])->name('admin.roles.update');
// Locale Routes
Route::get('/locales', 'Webkul\Core\Http\Controllers\LocaleController@index')->defaults('_config', [
'view' => 'admin::locales.index'
])->name('admin.locales.index');
Route::get('/locales/create', 'Webkul\Core\Http\Controllers\LocaleController@create')->defaults('_config', [
'view' => 'admin::locales.create'
])->name('admin.locales.create');
Route::post('/locales/create', 'Webkul\Core\Http\Controllers\LocaleController@store')->defaults('_config', [
'redirect' => 'admin.locales.index'
])->name('admin.locales.store');
// Admin Profile route
Route::get('/account', 'Webkul\User\Http\Controllers\AccountController@edit')->defaults('_config', [
'view' => 'admin::account.edit'

View File

@ -18,12 +18,12 @@ class AdminServiceProvider extends ServiceProvider
{
include __DIR__ . '/../Http/routes.php';
$this->loadTranslationsFrom(__DIR__ . '/../Resources/lang', 'admin');
$this->publishes([
__DIR__ . '/../../publishable/assets' => public_path('vendor/webkul/admin/assets'),
], 'public');
$this->loadMigrationsFrom(__DIR__ . '/../Database/migrations');
$this->loadViewsFrom(__DIR__ . '/../Resources/views', 'admin');
$this->composeView();
@ -60,7 +60,7 @@ class AdminServiceProvider extends ServiceProvider
];
}
}
$view->with('menu', $menu)->with('subMenus', $subMenus)->with('tabs', $tabs);
});
}

View File

@ -10,11 +10,11 @@ use Webkul\Ui\Menu;
class EventServiceProvider extends ServiceProvider
{
/**
* Register services.
* Bootstrap services.
*
* @return void
*/
public function register()
public function boot()
{
$this->createAdminMenu();
@ -39,6 +39,10 @@ class EventServiceProvider extends ServiceProvider
Event::listen('admin.menu.build', function($menu) {
$menu->add('dashboard', 'Dashboard', 'admin.dashboard.index', 1, 'dashboard-icon');
$menu->add('catalog', 'Catalog', 'admin.catalog.attributes.index', 3, 'catalog-icon');
$menu->add('catalog.attributes', 'Attributes', 'admin.catalog.attributes.index', 3);
$menu->add('configuration', 'Configure', 'admin.account.edit', 6, 'configuration-icon');
$menu->add('configuration.account', 'My Account', 'admin.account.edit', 1);
@ -50,6 +54,8 @@ class EventServiceProvider extends ServiceProvider
$menu->add('settings.users.users', 'Users', 'admin.users.index', 1, '');
$menu->add('settings.users.roles', 'Roles', 'admin.roles.index', 2, '');
$menu->add('settings.locales', 'Locales', 'admin.locales.index', 2, '');
});
}
@ -67,13 +73,11 @@ class EventServiceProvider extends ServiceProvider
$acl->add('settings', 'Settings', 'admin.users.index', 6);
$acl->add('settings.users', 'Users', 'admin.users.index');
$acl->add('settings.users', 'Users', 'admin.users.index', 1);
$acl->add('settings.users.users', 'Users', 'admin.users.index');
$acl->add('settings.users.users', 'Users', 'admin.users.index', 1);
$acl->add('settings.users.roles', 'Roles', 'admin.roles.index');
$acl->add('settings.users.roles1', 'Roles 1', 'admin.roles.index');
$acl->add('settings.users.roles', 'Roles', 'admin.roles.index', 2);
});
}

View File

@ -0,0 +1,85 @@
@extends('admin::layouts.content')
@section('content')
<div class="content">
<form method="POST" action="{{ route('admin.catalog.attributes.store') }}">
<div class="page-header">
<div class="page-title">
<h1>{{ __('Add Attribute') }}</h1>
</div>
<div class="page-action">
<button type="submit" class="btn btn-lg btn-primary">
{{ __('Save Attribute') }}
</button>
</div>
</div>
<div class="page-content">
<div class="form-container">
@csrf()
<accordian :title="'{{ __('General') }}'" :active="true">
<div class="accordian-content">
<div class="control-group" :class="[errors.has('code') ? 'has-error' : '']">
<label for="code">{{ __('Attribute Code') }}</label>
<input type="text" v-validate="'required'" class="control" id="code" name="code" value="{{ old('code') }}"/>
<span class="control-error" v-if="errors.has('code')">@{{ errors.first('code') }}</span>
</div>
<div class="control-group">
<label for="type">{{ __('Attribute Type') }}</label>
<select class="control" id="type" name="type">
<option value="text">{{ __('Text') }}</option>
<option value="textarea">{{ __('Textarea') }}</option>
<option value="integer">{{ __('Integer') }}</option>
<option value="select">{{ __('Select') }}</option>
<option value="multiselect">{{ __('Multiselect') }}</option>
<option value="checkbox">{{ __('Multiselect') }}</option>
<option value="datetime">{{ __('Datetime') }}</option>
<option value="date">{{ __('Date') }}</option>
</select>
</div>
</div>
</accordian>
<accordian :title="'{{ __('Label') }}'" :active="true">
<div class="accordian-content">
<div class="control-group" :class="[errors.has('name') ? 'has-error' : '']">
<label for="name">{{ __('Admin') }}</label>
<input type="text" v-validate="'required'" class="control" id="name" name="name"/>
<span class="control-error" v-if="errors.has('name')">@{{ errors.first('name') }}</span>
</div>
@foreach(Webkul\Core\Models\Locale::all() as $locale)
<div class="control-group">
<label for="locale-{{ $locale->code }}">{{ $locale->name . ' (' . $locale->code . ')' }}</label>
<input type="text" class="control" id="locale-{{ $locale->code }}" name="<?php echo $locale->code; ?>[name]"/>
</div>
@endforeach
</div>
</accordian>
<accordian :title="'{{ __('Options') }}'" :active="true" :class-name="'hide'" :id="'options'">
</accordian>
<accordian :title="'{{ __('Validations') }}'" :active="true">
</accordian>
<accordian :title="'{{ __('Configuration') }}'" :active="true">
</accordian>
</div>
</div>
</form>
</div>
@stop
@section('javascript')
@stop

View File

@ -0,0 +1,21 @@
@extends('admin::layouts.content')
@section('content')
<div class="content">
<div class="page-header">
<div class="page-title">
Attributes
</div>
<div class="page-action">
<a href="{{ route('admin.catalog.attributes.create') }}" class="btn btn-lg btn-primary">
{{ __('Add Attribute') }}
</a>
</div>
</div>
<div class="page-content">
</div>
</div>
@stop

View File

@ -0,0 +1,43 @@
@extends('admin::layouts.content')
@section('content')
<div class="content">
<form method="POST" action="{{ route('admin.locales.store') }}" @submit.prevent="onSubmit">
<div class="page-header">
<div class="page-title">
<h1>{{ __('Add Locale') }}</h1>
</div>
<div class="page-action">
<button type="submit" class="btn btn-lg btn-primary">
{{ __('Save Locale') }}
</button>
</div>
</div>
<div class="page-content">
<div class="form-container">
@csrf()
<accordian :title="'{{ __('General') }}'" :active="true">
<div class="accordian-content">
<div class="control-group" :class="[errors.has('code') ? 'has-error' : '']">
<label for="code">{{ __('Code') }}</label>
<input v-validate="'required'" class="control" id="code" name="code"/>
<span class="control-error" v-if="errors.has('code')">@{{ errors.first('code') }}</span>
</div>
<div class="control-group" :class="[errors.has('name') ? 'has-error' : '']">
<label for="name">{{ __('Name') }}</label>
<input v-validate="'required'" class="control" id="name" name="name"/>
<span class="control-error" v-if="errors.has('name')">@{{ errors.first('name') }}</span>
</div>
</div>
</accordian>
</div>
</div>
</form>
</div>
@stop

View File

@ -0,0 +1,21 @@
@extends('admin::layouts.content')
@section('content')
<div class="content">
<div class="page-header">
<div class="page-title">
</div>
<div class="page-action">
<a href="{{ route('admin.locales.create') }}" class="btn btn-lg btn-primary">
{{ __('Add Locale') }}
</a>
</div>
</div>
<div class="page-content">
</div>
</div>
@stop

View File

@ -46,7 +46,7 @@
</div>
<div class="control-group">
<tree-view value-field="route" id-field="key" value-field="route" items='@json($acl->items)'></tree-view>
<tree-view value-field="key" id-field="key" items='@json($acl->items)'></tree-view>
</div>
</div>
</accordian>

View File

@ -0,0 +1,74 @@
@extends('admin::layouts.content')
@section('content')
<div class="content">
<form method="POST" action="{{ route('admin.roles.update', $role->id) }}" @submit.prevent="onSubmit">
<div class="page-header">
<div class="page-title">
<h1>{{ __('Edit Role') }}</h1>
</div>
<div class="page-action">
<button type="submit" class="btn btn-lg btn-primary">
{{ __('Save Role') }}
</button>
</div>
</div>
<div class="page-content">
<div class="form-container">
@csrf()
<input name="_method" type="hidden" value="PUT">
<accordian :title="'{{ __('General') }}'" :active="true">
<div class="accordian-content">
<div class="control-group" :class="[errors.has('name') ? 'has-error' : '']">
<label for="name">{{ __('Name') }}</label>
<input type="text" v-validate="'required'" class="control" id="email" name="name" value="{{ $role->name }}"/>
<span class="control-error" v-if="errors.has('name')">@{{ errors.first('name') }}</span>
</div>
<div class="control-group">
<label for="description">{{ __('Description') }}</label>
<textarea class="control" id="description" name="description">{{ $role->description }}</textarea>
</div>
</div>
</accordian>
<accordian :title="'{{ __('Access Control') }}'" :active="true">
<div class="accordian-content">
<div class="control-group">
<label for="permission_type">{{ __('Permissions') }}</label>
<select class="control" name="permission_type" id="permission_type">
<option value="custom" {{ $role->permission_type == 'custom' ? 'selected' : '' }}>{{ __('Custom') }}</option>
<option value="all" {{ $role->permission_type == 'all' ? 'selected' : '' }}>{{ __('All') }}</option>
</select>
</div>
<div class="control-group tree-wrapper {{ $role->permission_type == 'all' ? 'hide' : '' }}">
<tree-view value-field="key" id-field="key" items='@json($acl->items)' value='@json($role->permissions)'></tree-view>
</div>
</div>
</accordian>
</div>
</div>
</form>
</div>
@stop
@section('javascript')
<script>
$(document).ready(function () {
$('#permission_type').on('change', function(e) {
if($(e.target).val() == 'custom') {
$('.tree-wrapper').removeClass('hide')
} else {
$('.tree-wrapper').addClass('hide')
}
})
});
</script>
@stop

1
packages/Webkul/Attribute/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/node_modules

View File

@ -0,0 +1,27 @@
{
"name": "webkul/laravel-attribute",
"license": "MIT",
"authors": [
{
"name": "Jitendra Singh",
"email": "jitendra@webkul.com"
}
],
"require": {
"nwidart/laravel-modules": "^3.2"
},
"autoload": {
"psr-4": {
"Webkul\\Attribute\\": "src/"
}
},
"extra": {
"laravel": {
"providers": [
"Webkul\\Attribute\\Providers\\AttributeServiceProvider"
],
"aliases": { }
}
},
"minimum-stability": "dev"
}

View File

@ -0,0 +1,43 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateAttributesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('attributes', function (Blueprint $table) {
$table->increments('id');
$table->string('code')->unique();
$table->string('name');
$table->string('type');
$table->string('validation')->nullable();
$table->integer('position')->nullable();
$table->boolean('is_required');
$table->boolean('is_unique');
$table->boolean('value_per_locale');
$table->boolean('value_per_channel');
$table->boolean('is_filterable');
$table->boolean('is_configurable');
$table->boolean('is_user_defined')->default(1);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('attributes');
}
}

View File

@ -0,0 +1,35 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateAttributeTranslationsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('attribute_translations', function (Blueprint $table) {
$table->increments('id');
$table->string('locale');
$table->text('name')->nullable();
$table->integer('attribute_id')->unsigned();
$table->unique(['attribute_id', 'locale']);
$table->foreign('attribute_id')->references('id')->on('attributes')->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('attribute_translations');
}
}

View File

@ -0,0 +1,35 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateAttributeGroupsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('attribute_groups', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->timestamps();
$table->integer('sort_order');
$table->integer('attribute_family_id')->unsigned();
$table->unique(['attribute_family_id', 'name']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('attribute_groups');
}
}

View File

@ -0,0 +1,36 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateAttributeFamiliesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('attribute_families', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->boolean('status')->default(0);
});
Schema::table('attribute_groups', function($table) {
$table->foreign('attribute_family_id')->references('id')->on('attribute_families')->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('attribute_families');
}
}

View File

@ -0,0 +1,35 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateAttributeOptionsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('attribute_options', function (Blueprint $table) {
$table->increments('id');
$table->string('code');
$table->integer('sort_order');
$table->integer('attribute_id')->unsigned();
$table->unique(['attribute_id', 'code']);
$table->foreign('attribute_id')->references('id')->on('attributes')->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('attribute_options');
}
}

View File

@ -0,0 +1,35 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateAttributeOptionTranslationsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('attribute_option_translations', function (Blueprint $table) {
$table->increments('id');
$table->string('locale');
$table->text('label')->nullable();
$table->integer('attribute_option_id')->unsigned();
$table->unique(['attribute_option_id', 'locale']);
$table->foreign('attribute_option_id')->references('id')->on('attribute_options')->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('attribute_option_translations');
}
}

View File

@ -0,0 +1,119 @@
<?php
namespace Webkul\Attribute\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Webkul\Attribute\Models\Attribute;
/**
* Catalog attribute controller
*
* @author Jitendra Singh <jitendra@webkul.com>
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class AttributeController extends Controller
{
/**
* Contains route related configuration
*
* @var array
*/
protected $_config;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->_config = request('_config');
}
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
return view($this->_config['view']);
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
return view($this->_config['view'], compact('roleItems'));
}
/**
* Store a newly created resource in storage.
*
* @return \Illuminate\Http\Response
*/
public function store()
{
$this->validate(request(), [
'code' => ['required', 'unique:attributes,code', new \Webkul\Core\Contracts\Validations\Slug],
'name' => 'required',
'type' => 'required'
]);
Attribute::create(request()->all());
session()->flash('success', 'Attribute created successfully.');
return redirect()->route($this->_config['redirect']);
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
$role = Role::findOrFail($id);
return view($this->_config['view'], compact('role'));
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
$this->validate(request(), [
'name' => 'required',
'permission_type' => 'required',
]);
$role = Role::findOrFail($id);
$role->update(request()->all());
session()->flash('success', 'Role updated successfully.');
return redirect()->route($this->_config['redirect']);
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
//
}
}

View File

@ -0,0 +1,13 @@
<?php
namespace Webkul\Attribute\Http\Controllers;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
class Controller extends BaseController
{
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
}

View File

@ -0,0 +1,13 @@
<?php
namespace Webkul\Attribute\Models;
use Illuminate\Database\Eloquent\Model;
use Dimsav\Translatable\Translatable;
class Attribute extends Model
{
use Translatable;
public $translatedAttributes = ['name'];
}

View File

@ -0,0 +1,9 @@
<?php
namespace Webkul\Attribute\Models;
use Illuminate\Database\Eloquent\Model;
class AttributeFamily extends Model
{
}

View File

@ -0,0 +1,9 @@
<?php
namespace Webkul\Attribute\Models;
use Illuminate\Database\Eloquent\Model;
class AttributeGroup extends Model
{
}

View File

@ -0,0 +1,13 @@
<?php
namespace Webkul\Attribute\Models;
use Illuminate\Database\Eloquent\Model;
use Dimsav\Translatable\Translatable;
class AttributeOption extends Model
{
use Translatable;
public $translatedAttributes = ['label'];
}

View File

@ -0,0 +1,12 @@
<?php
namespace Webkul\Attribute\Models;
use Illuminate\Database\Eloquent\Model;
class AttributeOptionTranslation extends Model
{
public $timestamps = false;
protected $fillable = ['label'];
}

View File

@ -0,0 +1,12 @@
<?php
namespace Webkul\Attribute\Models;
use Illuminate\Database\Eloquent\Model;
class AttributeTranslation extends Model
{
public $timestamps = false;
protected $fillable = ['name'];
}

View File

@ -0,0 +1,30 @@
<?php
namespace Webkul\Attribute\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Foundation\AliasLoader;
use Illuminate\Routing\Router;
class AttributeServiceProvider extends ServiceProvider
{
/**
* Bootstrap services.
*
* @return void
*/
public function boot(Router $router)
{
$this->loadMigrationsFrom(__DIR__ . '/../Database/Migrations');
}
/**
* Register services.
*
* @return void
*/
public function register()
{
}
}

1
packages/Webkul/Category/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/node_modules

View File

@ -0,0 +1,25 @@
{
"name": "webkul/laravel-category",
"license": "MIT",
"authors": [
{
"name": "Jitendra Singh",
"email": "jitendra@webkul.com"
}
],
"require": {},
"autoload": {
"psr-4": {
"Webkul\\Attribute\\": "src/"
}
},
"extra": {
"laravel": {
"providers": [
"Webkul\\Attribute\\Providers\\AttributeServiceProvider"
],
"aliases": { }
}
},
"minimum-stability": "dev"
}

View File

@ -0,0 +1,35 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateCategoriesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('categories', function (Blueprint $table) {
$table->increments('id');
$table->string('code')->unique();
$table->integer('position');
$table->integer('parent_id')->unsigned()->nullable();
$table->foreign('parent_id')->references('id')->on('categories')->onDelete('cascade');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('categories');
}
}

View File

@ -0,0 +1,31 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateCategoryNameTranslationTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('category_name_translation', function (Blueprint $table) {
$table->increments('id');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('category_name_translation');
}
}

View File

@ -0,0 +1,31 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateCategoryDescriptionTranslationsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('category_description_translations', function (Blueprint $table) {
$table->increments('id');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('category_description_translations');
}
}

View File

@ -0,0 +1,30 @@
<?php
namespace Webkul\Category\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Foundation\AliasLoader;
use Illuminate\Routing\Router;
class CategoryServiceProvider extends ServiceProvider
{
/**
* Bootstrap services.
*
* @return void
*/
public function boot(Router $router)
{
$this->loadMigrationsFrom(__DIR__ . '/../Database/Migrations');
}
/**
* Register services.
*
* @return void
*/
public function register()
{
}
}

1
packages/Webkul/Core/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/node_modules

View File

@ -0,0 +1,27 @@
{
"name": "webkul/laravel-core",
"license": "MIT",
"authors": [
{
"name": "Jitendra Singh",
"email": "jitendra@webkul.com"
}
],
"require": {
"propaganistas/laravel-intl": "^2.0"
},
"autoload": {
"psr-4": {
"Webkul\\Core\\": "src/"
}
},
"extra": {
"laravel": {
"providers": [
"Webkul\\Core\\Providers\\CoreServiceProvider"
],
"aliases": { }
}
},
"minimum-stability": "dev"
}

View File

@ -0,0 +1,27 @@
<?php
namespace Webkul\Core\Contracts;
/**
* Reposotory Interface
*
* @author Jitendra Singh <jitendra@webkul.com>
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
interface RepositoryInterface {
public function all($columns = ['*']);
public function paginate($perPage = 15, $columns = ['*']);
public function create(array $data);
public function update(array $data, $id);
public function delete($id);
public function find($id, $columns = ['*']);
public function findBy($field, $value, $columns = ['*']);
}

View File

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

View File

@ -0,0 +1,33 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateLocalesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('locales', function (Blueprint $table) {
$table->increments('id');
$table->string('code')->unique();
$table->string('name');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('locales');
}
}

View File

@ -0,0 +1,18 @@
<?php
namespace Webkul\Core\Database\Seeders;
use Illuminate\Database\Seeder;
class DatabaseSeeder extends Seeder
{
/**
* Seed the application's database.
*
* @return void
*/
public function run()
{
$this->call(LocalesTableSeeder::class);
}
}

View File

@ -0,0 +1,17 @@
<?php
namespace Webkul\Core\Database\Seeders;
use Illuminate\Database\Seeder;
use Webkul\Core\Models\Locale;
class LocalesTableSeeder extends Seeder
{
public function run()
{
$locale = new Locale();
$locale->code = 'en';
$locale->name = 'English';
$locale->save();
}
}

View File

@ -0,0 +1,120 @@
<?php
namespace Webkul\Core\Eloquent;
use Webkul\Core\Contracts\RepositoryInterface;
use Webkul\Core\Exceptions\RepositoryException;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Container\Container as App;
/**
* Reposotory
*
* @author Jitendra Singh <jitendra@webkul.com>
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
abstract class Repository implements RepositoryInterface {
/**
* @var App
*/
private $app;
/**
* @var \Illuminate\Database\Eloquent\Model
*/
protected $model;
/**
* @param App $app
* @throws \Webkul\Core\Exceptions\RepositoryException
*/
public function __construct(App $app) {
$this->app = $app;
$this->makeModel();
}
/**
* Specify Model class name
*
* @return mixed
*/
public abstract function model();
/**
* @param array $columns
* @return mixed
*/
public function all($columns = ['*']) {
return $this->model->get($columns);
}
/**
* @param int $perPage
* @param array $columns
* @return mixed
*/
public function paginate($perPage = 1, $columns = ['*']) {
return $this->model->paginate($perPage, $columns);
}
/**
* @param array $data
* @return mixed
*/
public function create(array $data) {
return $this->model->create($data);
}
/**
* @param array $data
* @param $id
* @param string $attribute
* @return mixed
*/
public function update(array $data, $id, $attribute="id") {
return $this->model->where($attribute, '=', $id)->update($data);
}
/**
* @param $id
* @return mixed
*/
public function delete($id) {
return $this->model->destroy($id);
}
/**
* @param $id
* @param array $columns
* @return mixed
*/
public function find($id, $columns = ['*']) {
return $this->model->find($id, $columns);
}
/**
* @param $attribute
* @param $value
* @param array $columns
* @return mixed
*/
public function findBy($attribute, $value, $columns = ['*']) {
return $this->model->where($attribute, '=', $value)->first($columns);
}
/**
* @return \Illuminate\Database\Eloquent\Builder
* @throws RepositoryException
*/
public function makeModel() {
$model = $this->app->make($this->model());
if (!$model instanceof Model)
throw new RepositoryException("Class {$this->model()} must be an instance of Illuminate\\Database\\Eloquent\\Model");
return $this->model = $model->newQuery();
}
}

View File

@ -0,0 +1,14 @@
<?php
namespace Webkul\Core\Exceptions;
/**
* Reposotory Exception
*
* @author Jitendra Singh <jitendra@webkul.com>
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class RepositoryException extends \Exception
{
}

View File

@ -0,0 +1,13 @@
<?php
namespace Webkul\Core\Http\Controllers;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
class Controller extends BaseController
{
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
}

View File

@ -0,0 +1,84 @@
<?php
namespace Webkul\Core\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Webkul\Core\Models\Locale;
/**
* Locale controller
*
* @author Jitendra Singh <jitendra@webkul.com>
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class LocaleController extends Controller
{
/**
* Contains route related configuration
*
* @var array
*/
protected $_config;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->_config = request('_config');
}
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
return view($this->_config['view']);
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
return view($this->_config['view']);
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$this->validate(request(), [
'code' => 'required|unique:locales,code',
'name' => 'required'
]);
Locale::create(request(['code','name']));
session()->flash('success', 'Locale created successfully.');
return redirect()->route($this->_config['redirect']);
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
//
}
}

View File

@ -0,0 +1,18 @@
<?php
namespace Webkul\Core\Models;
use Illuminate\Database\Eloquent\Model;
use Webkul\User\Models\Admin;
class Locale extends Model
{
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'code', 'name'
];
}

View File

@ -0,0 +1,38 @@
<?php
namespace Webkul\Core\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Validator;
use Illuminate\Routing\Router;
use Illuminate\Foundation\AliasLoader;
class CoreServiceProvider extends ServiceProvider
{
/**
* Bootstrap services.
*
* @return void
*/
public function boot(Router $router)
{
$this->loadMigrationsFrom(__DIR__ . '/../Database/Migrations');
$this->loadTranslationsFrom(__DIR__ . '/../Resources/lang', 'core');
$this->publishes([
__DIR__ . '/../../publishable/lang' => public_path('vendor/webkul/core/lang'),
], 'public');
Validator::extend('slug', 'Webkul\Core\Contracts\Validations\Slug@passes');
}
/**
* Register services.
*
* @return void
*/
public function register()
{
}
}

View File

@ -0,0 +1,5 @@
<?php
return [
'slug' => 'The :attribute must be valid slug.'
];

View File

@ -67,6 +67,9 @@ class Menu {
* @return void
*/
public function sortItems($items) {
if(!$items) {
return;
}
usort($items, function($a, $b) {
if ($a['sort'] == $b['sort']) {
return 0;

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="48px" height="48px" viewBox="0 0 48 48" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 50.2 (55047) - http://www.bohemiancoding.com/sketch -->
<title>Icon-Catalog-Active</title>
<desc>Created with Sketch.</desc>
<defs></defs>
<g id="Icon-Catalog-Active" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round">
<g transform="translate(9.000000, 7.000000)" stroke="#0041FF" stroke-width="2">
<rect id="Rectangle-2" x="0" y="0" width="30" height="34"></rect>
<path d="M6,6 L24,6" id="Path-6"></path>
<path d="M6,13 L24,13" id="Path-6"></path>
<path d="M6,20 L24,20" id="Path-6"></path>
<path d="M6,27 L24,27" id="Path-6"></path>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 917 B

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="48px" height="48px" viewBox="0 0 48 48" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 50.2 (55047) - http://www.bohemiancoding.com/sketch -->
<title>Icon-Catalog</title>
<desc>Created with Sketch.</desc>
<defs></defs>
<g id="Icon-Catalog" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round">
<g transform="translate(9.000000, 7.000000)" stroke-width="2">
<rect id="Rectangle-2" stroke="#8E8E8E" x="0" y="0" width="30" height="34"></rect>
<path d="M6,6 L24,6" id="Path-6" stroke="#979797"></path>
<path d="M6,13 L24,13" id="Path-6" stroke="#979797"></path>
<path d="M6,20 L24,20" id="Path-6" stroke="#979797"></path>
<path d="M6,27 L24,27" id="Path-6" stroke="#979797"></path>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 971 B

View File

@ -1,5 +1,5 @@
<template>
<div class="accordian" :class="{ 'active': isActive }">
<div class="accordian" :class="[isActive ? 'active' : '', className]" :id="id">
<div class="accordian-header" @click="toggleAccordion()">
{{ title }}
<i class="icon" :class="iconClass"></i>
@ -11,6 +11,8 @@
export default {
props: {
title: String,
id: String,
className: String,
active: Boolean
},

View File

@ -24,6 +24,19 @@
type: Array,
required: false,
default: null
},
savedValues: {
type: Array,
required: false,
default: null
}
},
created () {
let index = this.savedValues.indexOf(this.items[this.valueField])
if(index !== -1) {
this.value.push(this.items);
}
},
@ -136,6 +149,7 @@
props: {
items: child,
value: this.value,
savedValues: this.savedValues,
captionField: this.captionField,
childrenField: this.childrenField,
valueField: this.valueField,

View File

@ -33,46 +33,28 @@
items: {
type: [Array, String, Object],
required: false,
default: () => ([{
"name": "Dashboard",
"value": "1",
}, {
"name": "Root",
"value": "2",
"children": [{
"name": "First Child",
"value": "3",
}, {
"name": "Second Child",
"value": "4",
"children": [{
"name": "GrandChild 1",
"value": "5",
}, {
"name": "GrandChild 2",
"value": "6",
}, {
"name":"GrandChild 3",
"value": "7",
}]
}]
}])
default: () => ([])
},
value: {
type: Array,
type: [Array, String, Object],
required: false,
default: () => ([])
}
},
created() {
this.finalValues = this.value;
},
data: () => ({
finalValues: []
}),
computed: {
savedValues () {
if(!this.value)
return [];
return (typeof this.value == 'string') ? JSON.parse(this.value) : this.value;
}
},
methods: {
@ -93,6 +75,7 @@
props: {
items: item,
value: this.finalValues,
savedValues: this.savedValues,
captionField: this.captionField,
childrenField: this.childrenField,
valueField: this.valueField,

View File

@ -319,6 +319,7 @@ h2 {
textarea.control {
height: 100px;
padding: 10px;
}
.control {

View File

@ -14,6 +14,10 @@
@extend %menu-properties;
background-image: url('../images/Icon-Dashboard.svg');
}
.catalog-icon {
@extend %menu-properties;
background-image: url('../images/Icon-Catalog.svg');
}
.configuration-icon {
@extend %menu-properties;
background-image: url('../images/Icon-Configure.svg');
@ -107,16 +111,19 @@
}
.active {
.icon-dashboard {
.dashboard-icon {
background-image: url('../images/Icon-Dashboard-Active.svg');
}
.icon-settings {
.catalog-icon {
background-image: url('../images/Icon-Catalog-Active.svg');
}
.settings-icon {
background-image: url('../images/Icon-Settings-Active.svg');
}
.icon-configuration {
@extend %menu-properties;
.configuration-icon {
background-image: url('../images/Icon-Configure-Active.svg');
}

View File

@ -16,7 +16,7 @@ class ACLCreator {
public static function create($callback) {
$acl = new ACLCreator();
$callback($acl);
$acl->sortItems($acl->items);
$acl->items = $acl->sortItems($acl->items);
return $acl;
}
@ -40,7 +40,7 @@ class ACLCreator {
];
$children = str_replace('.', '.children.', $key);
array_set($this->items, $children, $item);
$this->array_set($this->items, $children, $item);
}
/**
@ -49,6 +49,12 @@ class ACLCreator {
* @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;
@ -59,4 +65,47 @@ class ACLCreator {
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;
}
}

View File

@ -64,7 +64,6 @@ class RoleController extends Controller
'permission_type' => 'required',
]);
Role::create(request()->all());
session()->flash('success', 'Role created successfully.');
@ -94,9 +93,14 @@ class RoleController extends Controller
*/
public function update(Request $request, $id)
{
$this->validate(request(), [
'name' => 'required',
'permission_type' => 'required',
]);
$role = Role::findOrFail($id);
$role->update(request(['name', 'description', 'permissions']));
$role->update(request()->all());
session()->flash('success', 'Role updated successfully.');

View File

@ -22,7 +22,7 @@ class UserServiceProvider extends ServiceProvider
{
$router->aliasMiddleware('admin', RedirectIfNotAdmin::class);
$this->loadMigrationsFrom(__DIR__ . '/../Database/migrations');
$this->loadMigrationsFrom(__DIR__ . '/../Database/Migrations');
$this->createACL();
}
@ -49,6 +49,10 @@ class UserServiceProvider extends ServiceProvider
public function register()
{
$this->registerBouncer();
Event::listen('admin.acl.build', function($acl) {
$acl->add('settings.users.roles1', 'Roles1', 'admin.roles.index1', 3);
});
}
/**

15
packages/Webkul/User/webpack.mix.js vendored Normal file
View File

@ -0,0 +1,15 @@
const { mix } = require('laravel-mix');
require('laravel-mix-merge-manifest');
// var publicPath = 'publishable/assets';
var publicPath = '../../../public/vendor/webkul/core/assets';
mix.setPublicPath(publicPath).mergeManifest();
mix.disableNotifications();
mix.copyDirectory( __dirname + '/src/Resources/assets/lang', publicPath + '/lang')
if (mix.inProduction()) {
mix.version();
}

View File

@ -1,4 +1,4 @@
.dashboard-icon, .configuration-icon, .settings-icon, .active .icon-configuration, .active.configuration-icon {
.dashboard-icon, .catalog-icon, .configuration-icon, .settings-icon, .active.configuration-icon {
width: 48px;
height: 48px;
margin-bottom: 10px;
@ -15,6 +15,10 @@
background-image: url("../images/Icon-Dashboard.svg");
}
.catalog-icon {
background-image: url("../images/Icon-Catalog.svg");
}
.configuration-icon {
background-image: url("../images/Icon-Configure.svg");
}
@ -107,15 +111,19 @@
height: 24px;
}
.active .icon-dashboard {
.active .dashboard-icon {
background-image: url("../images/Icon-Dashboard-Active.svg");
}
.active .icon-settings {
.active .catalog-icon {
background-image: url("../images/Icon-Catalog-Active.svg");
}
.active .settings-icon {
background-image: url("../images/Icon-Settings-Active.svg");
}
.active .icon-configuration {
.active .configuration-icon {
background-image: url("../images/Icon-Configure-Active.svg");
}
@ -540,6 +548,7 @@ h2 {
.control-group textarea.control {
height: 100px;
padding: 10px;
}
.control-group .control {

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="48px" height="48px" viewBox="0 0 48 48" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 50.2 (55047) - http://www.bohemiancoding.com/sketch -->
<title>Icon-Catalog-Active</title>
<desc>Created with Sketch.</desc>
<defs></defs>
<g id="Icon-Catalog-Active" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round">
<g transform="translate(9.000000, 7.000000)" stroke="#0041FF" stroke-width="2">
<rect id="Rectangle-2" x="0" y="0" width="30" height="34"></rect>
<path d="M6,6 L24,6" id="Path-6"></path>
<path d="M6,13 L24,13" id="Path-6"></path>
<path d="M6,20 L24,20" id="Path-6"></path>
<path d="M6,27 L24,27" id="Path-6"></path>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 917 B

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="48px" height="48px" viewBox="0 0 48 48" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 50.2 (55047) - http://www.bohemiancoding.com/sketch -->
<title>Icon-Catalog</title>
<desc>Created with Sketch.</desc>
<defs></defs>
<g id="Icon-Catalog" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round">
<g transform="translate(9.000000, 7.000000)" stroke-width="2">
<rect id="Rectangle-2" stroke="#8E8E8E" x="0" y="0" width="30" height="34"></rect>
<path d="M6,6 L24,6" id="Path-6" stroke="#979797"></path>
<path d="M6,13 L24,13" id="Path-6" stroke="#979797"></path>
<path d="M6,20 L24,20" id="Path-6" stroke="#979797"></path>
<path d="M6,27 L24,27" id="Path-6" stroke="#979797"></path>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 971 B

View File

@ -492,6 +492,8 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
/* harmony default export */ __webpack_exports__["default"] = ({
props: {
title: String,
id: String,
className: String,
active: Boolean
},
@ -531,7 +533,11 @@ var render = function() {
var _c = _vm._self._c || _h
return _c(
"div",
{ staticClass: "accordian", class: { active: _vm.isActive } },
{
staticClass: "accordian",
class: [_vm.isActive ? "active" : "", _vm.className],
attrs: { id: _vm.id }
},
[
_c(
"div",
@ -653,35 +659,12 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
type: [Array, String, Object],
required: false,
default: function _default() {
return [{
"name": "Dashboard",
"value": "1"
}, {
"name": "Root",
"value": "2",
"children": [{
"name": "First Child",
"value": "3"
}, {
"name": "Second Child",
"value": "4",
"children": [{
"name": "GrandChild 1",
"value": "5"
}, {
"name": "GrandChild 2",
"value": "6"
}, {
"name": "GrandChild 3",
"value": "7"
}]
}]
}];
return [];
}
},
value: {
type: Array,
type: [Array, String, Object],
required: false,
default: function _default() {
return [];
@ -689,17 +672,20 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
}
},
created: function created() {
this.finalValues = this.value;
},
data: function data() {
return {
finalValues: []
};
},
computed: {
savedValues: function savedValues() {
if (!this.value) return [];
return typeof this.value == 'string' ? JSON.parse(this.value) : this.value;
}
},
methods: {
generateChildren: function generateChildren() {
var childElements = [];
@ -719,6 +705,7 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
props: {
items: item,
value: this.finalValues,
savedValues: this.savedValues,
captionField: this.captionField,
childrenField: this.childrenField,
valueField: this.valueField,
@ -821,9 +808,23 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr
type: Array,
required: false,
default: null
},
savedValues: {
type: Array,
required: false,
default: null
}
},
created: function created() {
var index = this.savedValues.indexOf(this.items[this.valueField]);
if (index !== -1) {
this.value.push(this.items);
}
},
computed: {
caption: function caption() {
return this.items[this.captionField];
@ -946,6 +947,7 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr
props: {
items: child,
value: this.value,
savedValues: this.savedValues,
captionField: this.captionField,
childrenField: this.childrenField,
valueField: this.valueField,