Skip to content

Commit 29c2d1b

Browse files
committed
first commit
0 parents  commit 29c2d1b

33 files changed

+1951
-0
lines changed

composer.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"name": "rc1021/laravel-menu-architect",
3+
"description": "backend menu builder",
4+
"require": {
5+
"spatie/laravel-menu": "3.4.0",
6+
"illuminate/support": "^6.0"
7+
},
8+
"license": "MIT",
9+
"authors": [
10+
{
11+
"name": "rc1021",
12+
"email": "[email protected]"
13+
}
14+
],
15+
"autoload": {
16+
"psr-4": {
17+
"Rc1021\\LaravelMenuArchitect\\": "src"
18+
}
19+
},
20+
"extra": {
21+
"laravel": {
22+
"providers": [
23+
"Rc1021\\LaravelMenuArchitect\\LaravelMenuArchitectServiceProvider"
24+
]
25+
}
26+
}
27+
}

config/menu_architect.php

Lines changed: 240 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,240 @@
1+
<?php
2+
3+
return [
4+
5+
/*
6+
|--------------------------------------------------------------------------
7+
| Ajax Build ?
8+
|--------------------------------------------------------------------------
9+
|
10+
| View edit by ajax if the value is true.
11+
|
12+
*/
13+
14+
'ajax' => false,
15+
16+
/*
17+
|--------------------------------------------------------------------------
18+
| Middleware
19+
|--------------------------------------------------------------------------
20+
|
21+
| you can add your own middleware here
22+
|
23+
*/
24+
25+
'middleware' => ['web', 'auth'],
26+
27+
/*
28+
|--------------------------------------------------------------------------
29+
| Output display
30+
|--------------------------------------------------------------------------
31+
|
32+
| Display html by 'nestable', 'bootstrap', 'array', 'json', 'adminlte-sidebar'
33+
|
34+
*/
35+
36+
'output' => 'nestable',
37+
38+
/*
39+
|--------------------------------------------------------------------------
40+
| Table Migrate
41+
|--------------------------------------------------------------------------
42+
|
43+
| you can set your own table prefix, table names here
44+
|
45+
*/
46+
47+
'table_prefix' => '',
48+
49+
'table_name_menus' => 'menu_architects',
50+
51+
'table_name_items' => 'menu_architect_items',
52+
53+
'table_default_color' => '#000000', // menu item text color
54+
55+
'table_default_target' => '_self', // click Open In ['_self', '_blank']
56+
57+
/*
58+
|--------------------------------------------------------------------------
59+
| Role relation
60+
|--------------------------------------------------------------------------
61+
|
62+
| here you can make menu items visible to specific roles
63+
|
64+
*/
65+
66+
'use_roles' => false,
67+
68+
'roles_table' => 'roles',
69+
70+
'roles_pk' => 'id',
71+
72+
'roles_title_field' => 'name',
73+
74+
/*
75+
|--------------------------------------------------------------------------
76+
| Plugins Initialization
77+
|--------------------------------------------------------------------------
78+
|
79+
| Configure which JavaScript plugins should be included. At this moment,
80+
| DataTables, Select2, Chartjs and SweetAlert are added out-of-the-box,
81+
| including the Javascript and CSS files from a CDN via script and link tag.
82+
| Plugin Name, active status and files array (even empty) are required.
83+
| Files, when added, need to have type (js or css), asset (true or false) and location (string).
84+
| When asset is set to true, the location will be output using asset() function.
85+
|
86+
*/
87+
88+
'plugins' => [
89+
[
90+
'name' => 'jQuery',
91+
'active' => true,
92+
'files' => [
93+
[
94+
'type' => 'js',
95+
'asset' => false,
96+
'location' => '//cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js',
97+
],
98+
],
99+
],
100+
[
101+
'name' => 'RamonSmit Nestable2',
102+
'active' => true,
103+
'files' => [
104+
[
105+
'type' => 'js',
106+
'asset' => false,
107+
'location' => '//cdnjs.cloudflare.com/ajax/libs/nestable2/1.6.0/jquery.nestable.min.js',
108+
],
109+
[
110+
'type' => 'css',
111+
'asset' => false,
112+
'location' => '//cdnjs.cloudflare.com/ajax/libs/nestable2/1.6.0/jquery.nestable.min.css',
113+
],
114+
],
115+
],
116+
[
117+
'name' => 'jquery-ujs',
118+
'active' => true,
119+
'files' => [
120+
[
121+
'type' => 'js',
122+
'asset' => false,
123+
'location' => '//cdnjs.cloudflare.com/ajax/libs/jquery-ujs/1.2.2/rails.min.js',
124+
],
125+
],
126+
],
127+
[
128+
'name' => 'twitter-bootstrap',
129+
'active' => true,
130+
'files' => [
131+
[
132+
'type' => 'js',
133+
'asset' => false,
134+
'location' => '//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.min.js',
135+
],
136+
[
137+
'type' => 'css',
138+
'asset' => false,
139+
'location' => '//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap.min.css',
140+
],
141+
],
142+
],
143+
[
144+
'name' => 'Simonwep color pickr',
145+
'active' => true,
146+
'files' => [
147+
[
148+
'type' => 'js',
149+
'asset' => false,
150+
'location' => '//cdn.jsdelivr.net/npm/@simonwep/pickr/dist/pickr.es5.min.js',
151+
],
152+
[
153+
'type' => 'css',
154+
'asset' => false,
155+
'location' => '//cdn.jsdelivr.net/npm/@simonwep/pickr/dist/themes/classic.min.css',
156+
],
157+
],
158+
],
159+
[
160+
'name' => 'Sweetalert2',
161+
'active' => true,
162+
'files' => [
163+
[
164+
'type' => 'js',
165+
'asset' => false,
166+
'location' => '//cdn.jsdelivr.net/npm/sweetalert2@9',
167+
],
168+
],
169+
],
170+
[
171+
'name' => 'Select2',
172+
'active' => false,
173+
'files' => [
174+
[
175+
'type' => 'js',
176+
'asset' => false,
177+
'location' => '//cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/select2.min.js',
178+
],
179+
[
180+
'type' => 'css',
181+
'asset' => false,
182+
'location' => '//cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/css/select2.css',
183+
],
184+
],
185+
],
186+
[
187+
'name' => 'Chartjs',
188+
'active' => false,
189+
'files' => [
190+
[
191+
'type' => 'js',
192+
'asset' => false,
193+
'location' => '//cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.0/Chart.bundle.min.js',
194+
],
195+
],
196+
],
197+
[
198+
'name' => 'Laravel Menu Architect Main Assets',
199+
'active' => true,
200+
'files' => [
201+
// Boostrap Submenu
202+
[
203+
'type' => 'css',
204+
'asset' => true,
205+
'location' => 'vendor/menu_architect/css/boostrap-submenu.css',
206+
],
207+
// Nestable2 Draggable Handles
208+
[
209+
'type' => 'css',
210+
'asset' => true,
211+
'location' => 'vendor/menu_architect/css/nestable2.css',
212+
],
213+
// Simonwep Picker
214+
[
215+
'type' => 'js',
216+
'asset' => true,
217+
'location' => 'vendor/menu_architect/js/jquery-simonwep-pickr.js',
218+
],
219+
// jQuery Button Confirm
220+
[
221+
'type' => 'js',
222+
'asset' => true,
223+
'location' => 'vendor/menu_architect/js/jquery-btn-confirm.js',
224+
],
225+
// Menu Architect Main Style
226+
[
227+
'type' => 'css',
228+
'asset' => true,
229+
'location' => 'vendor/menu_architect/css/main.css',
230+
],
231+
[
232+
'type' => 'js',
233+
'asset' => true,
234+
'location' => 'vendor/menu_architect/js/main.js',
235+
],
236+
],
237+
],
238+
],
239+
240+
];
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
class CreateMenuArchitectsTable extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
public function up()
15+
{
16+
Schema::create( config('menu_architect.table_prefix') . config('menu_architect.table_name_menus'), function (Blueprint $table) {
17+
$table->bigIncrements('id');
18+
$table->string('name');
19+
$table->timestamps();
20+
});
21+
}
22+
23+
/**
24+
* Reverse the migrations.
25+
*
26+
* @return void
27+
*/
28+
public function down()
29+
{
30+
Schema::dropIfExists( config('menu_architect.table_prefix') . config('menu_architect.table_name_menus'));
31+
}
32+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
class CreateMenuArchitectItemsTable extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
public function up()
15+
{
16+
Schema::create( config('menu_architect.table_prefix') . config('menu_architect.table_name_items') , function (Blueprint $table) {
17+
$table->bigIncrements('id');
18+
$table->string('label');
19+
$table->string('link')->nullable();
20+
$table->string('route')->nullable();
21+
$table->string('query_string')->nullable();
22+
$table->unsignedBigInteger('parent_id')->default(0);
23+
$table->integer('sort')->default(0);
24+
$table->string('class')->nullable();
25+
$table->unsignedBigInteger('menu_id');
26+
$table->integer('depth')->default(0);
27+
$table->string('icon')->nullable();
28+
$table->string('color')->default(config('menu_architect.table_default_color'));
29+
$table->string('target')->default(config('menu_architect.table_default_target'));
30+
$table->timestamps();
31+
});
32+
}
33+
34+
/**
35+
* Reverse the migrations.
36+
*
37+
* @return void
38+
*/
39+
public function down()
40+
{
41+
Schema::dropIfExists( config('menu_architect.table_prefix') . config('menu_architect.table_name_items'));
42+
}
43+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
class AddRoleIdToMenuArchitectItemsTable extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
public function up()
15+
{
16+
Schema::table(config('menu_architect.table_prefix') . config('menu_architect.table_name_items'), function ($table) {
17+
$table->integer('role_id')->default(0);
18+
});
19+
}
20+
21+
/**
22+
* Reverse the migrations.
23+
*
24+
* @return void
25+
*/
26+
public function down()
27+
{
28+
Schema::table(config('menu_architect.table_prefix') . config('menu_architect.table_name_items'), function ($table) {
29+
$table->dropColumn('role_id');
30+
});
31+
}
32+
}

0 commit comments

Comments
 (0)