Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
laravel-adminpanel
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
laravel-adminpanel
Commits
43902b10
Commit
43902b10
authored
Dec 10, 2017
by
Vipul Basapati
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added Menu Module
parent
7a2f2dcb
Changes
30
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
30 changed files
with
1271 additions
and
6 deletions
+1271
-6
Backend.php
app/Http/Breadcrumbs/Backend/Backend.php
+1
-0
Menu.php
app/Http/Breadcrumbs/Backend/Menu.php
+16
-0
MenuController.php
app/Http/Controllers/Backend/Menu/MenuController.php
+121
-0
MenuFormController.php
app/Http/Controllers/Backend/Menu/MenuFormController.php
+25
-0
MenuTableController.php
app/Http/Controllers/Backend/Menu/MenuTableController.php
+50
-0
CreateMenuRequest.php
app/Http/Requests/Backend/Menu/CreateMenuRequest.php
+33
-0
DeleteMenuRequest.php
app/Http/Requests/Backend/Menu/DeleteMenuRequest.php
+33
-0
EditMenuRequest.php
app/Http/Requests/Backend/Menu/EditMenuRequest.php
+33
-0
ManageMenuRequest.php
app/Http/Requests/Backend/Menu/ManageMenuRequest.php
+33
-0
StoreMenuRequest.php
app/Http/Requests/Backend/Menu/StoreMenuRequest.php
+34
-0
UpdateMenuRequest.php
app/Http/Requests/Backend/Menu/UpdateMenuRequest.php
+34
-0
Menu.php
app/Models/Menu/Menu.php
+36
-0
MenuAttribute.php
app/Models/Menu/Traits/Attribute/MenuAttribute.php
+20
-0
MenuRepository.php
app/Repositories/Backend/Menu/MenuRepository.php
+98
-0
composer.json
composer.json
+1
-2
2017_12_10_122555_create_menus_table.php
database/migrations/2017_12_10_122555_create_menus_table.php
+37
-0
MenuTableSeeder.php
database/seeds/MenuTableSeeder.php
+29
-0
ModulesTableSeeder.php
database/seeds/ModulesTableSeeder.php
+122
-0
app.blade.php
resources/views/backend/layouts/app.blade.php
+1
-1
_add_custom_url_form.blade.php
resources/views/backend/menus/_add_custom_url_form.blade.php
+51
-0
create.blade.php
resources/views/backend/menus/create.blade.php
+38
-0
edit.blade.php
resources/views/backend/menus/edit.blade.php
+38
-0
form.blade.php
resources/views/backend/menus/form.blade.php
+229
-0
index.blade.php
resources/views/backend/menus/index.blade.php
+100
-0
header-buttons.blade.php
...ces/views/backend/menus/partials/header-buttons.blade.php
+30
-0
modal.blade.php
resources/views/backend/menus/partials/modal.blade.php
+14
-0
create.blade.php
resources/views/vendor/generator/create.blade.php
+1
-1
edit.blade.php
resources/views/vendor/generator/edit.blade.php
+1
-1
index.blade.php
resources/views/vendor/generator/index.blade.php
+1
-1
Menu.php
routes/Backend/Menu.php
+11
-0
No files found.
app/Http/Breadcrumbs/Backend/Backend.php
View file @
43902b10
...
...
@@ -15,4 +15,5 @@ require __DIR__.'/Blog_Category.php';
require
__DIR__
.
'/Blog_Tag.php'
;
require
__DIR__
.
'/Blog_Management.php'
;
require
__DIR__
.
'/Faqs.php'
;
require
__DIR__
.
'/Menu.php'
;
require
__DIR__
.
'/LogViewer.php'
;
app/Http/Breadcrumbs/Backend/Menu.php
0 → 100644
View file @
43902b10
<?php
Breadcrumbs
::
register
(
'admin.menus.index'
,
function
(
$breadcrumbs
)
{
$breadcrumbs
->
parent
(
'admin.dashboard'
);
$breadcrumbs
->
push
(
trans
(
'menus.backend.menus.management'
),
route
(
'admin.menus.index'
));
});
Breadcrumbs
::
register
(
'admin.menus.create'
,
function
(
$breadcrumbs
)
{
$breadcrumbs
->
parent
(
'admin.menus.index'
);
$breadcrumbs
->
push
(
trans
(
'menus.backend.menus.create'
),
route
(
'admin.menus.create'
));
});
Breadcrumbs
::
register
(
'admin.menus.edit'
,
function
(
$breadcrumbs
,
$id
)
{
$breadcrumbs
->
parent
(
'admin.menus.index'
);
$breadcrumbs
->
push
(
trans
(
'menus.backend.menus.edit'
),
route
(
'admin.menus.edit'
,
$id
));
});
app/Http/Controllers/Backend/Menu/MenuController.php
0 → 100644
View file @
43902b10
<?php
namespace
App\Http\Controllers\Backend\Menu
;
use
App\Models\Menu\Menu
;
use
Illuminate\Http\Request
;
use
App\Http\Controllers\Controller
;
use
App\Repositories\Backend\Menu\MenuRepository
;
use
App\Http\Requests\Backend\Menu\StoreMenuRequest
;
use
App\Http\Requests\Backend\Menu\ManageMenuRequest
;
use
App\Http\Requests\Backend\Menu\CreateMenuRequest
;
use
App\Http\Requests\Backend\Menu\EditMenuRequest
;
use
App\Http\Requests\Backend\Menu\DeleteMenuRequest
;
use
App\Http\Requests\Backend\Menu\UpdateMenuRequest
;
use
Illuminate\Support\Facades\DB
;
class
MenuController
extends
Controller
{
protected
$menu
;
/**
* @param \App\Repositories\Backend\Menu\MenuRepository $menu
*/
public
function
__construct
(
MenuRepository
$menu
)
{
$this
->
menu
=
$menu
;
}
/**
* Display a listing of the resource.
* @param \App\Http\Requests\Backend\Menu\ManageMenuRequest $request
*
* @return \Illuminate\Http\Response
*/
public
function
index
(
ManageMenuRequest
$request
)
{
return
view
(
'backend.menus.index'
);
}
/**
* Show the form for creating a new resource.
* @param \App\Http\Requests\Backend\Menu\CreateMenuRequest $request
*
* @return \Illuminate\Http\Response
*/
public
function
create
(
CreateMenuRequest
$request
)
{
$types
=
[
"backend"
=>
"Backend"
,
"frontend"
=>
"Frontend"
];
$modules
=
DB
::
table
(
'modules'
)
->
get
();
return
view
(
'backend.menus.create'
)
->
withTypes
(
$types
)
->
withModules
(
$modules
);
}
/**
* Store a newly created resource in storage.
* @param \App\Http\Requests\Backend\Menu\StoreMenuRequest $request
*
* @return \Illuminate\Http\Response
*/
public
function
store
(
StoreMenuRequest
$request
)
{
$this
->
menu
->
create
(
$request
->
except
(
'_token'
));
return
redirect
()
->
route
(
'admin.menus.index'
)
->
withFlashSuccess
(
trans
(
'alerts.backend.menus.created'
));
}
/**
* Show the form for editing the specified resource.
* @param \App\Models\Menu\Menu $menu
* @param \App\Http\Requests\Backend\Menu\EditMenuRequest $request
* @return \Illuminate\Http\Response
*/
public
function
edit
(
Menu
$menu
,
EditMenuRequest
$request
)
{
$types
=
[
"backend"
=>
"Backend"
,
"frontend"
=>
"Frontend"
];
$modules
=
DB
::
table
(
'modules'
)
->
get
();
return
view
(
'backend.menus.edit'
)
->
with
(
'types'
,
$types
)
->
with
(
'menu'
,
$menu
)
->
with
(
'modules'
,
$modules
);
}
/**
* Update the specified resource in storage.
*
* @param \App\Models\Menu\Menu $menu
* @param \App\Http\Requests\Backend\Menu\UpdateMenuRequest $request
*
* @return \Illuminate\Http\Response
*/
public
function
update
(
Menu
$menu
,
UpdateMenuRequest
$request
)
{
$this
->
menu
->
update
(
$menu
,
$request
->
all
());
return
redirect
()
->
route
(
'admin.menus.index'
)
->
with
(
'flash_success'
,
trans
(
'alerts.backend.menus.updated'
));
}
/**
* Remove the specified resource from storage.
* @param \App\Models\Menu\Menu $menu
* @param \App\Http\Requests\Backend\Menu\DeleteMenuRequest $request
* @return \Illuminate\Http\Response
*/
public
function
destroy
(
Menu
$menu
,
DeleteMenuRequest
$request
)
{
$this
->
menu
->
delete
(
$menu
);
return
redirect
()
->
route
(
'admin.menus.index'
)
->
with
(
'flash_success'
,
trans
(
'alerts.backend.menus.deleted'
));
}
}
app/Http/Controllers/Backend/Menu/MenuFormController.php
0 → 100644
View file @
43902b10
<?php
namespace
App\Http\Controllers\Backend\Menu
;
use
App\Http\Controllers\Controller
;
use
App\Http\Requests\Backend\Menu\CreateMenuRequest
;
class
MenuFormController
extends
Controller
{
/**
* Get the form for modal popup.
* @param string $formName
* @param \App\Http\Requests\Backend\Menu\CreateMenuRequest
*
* @return \Illuminate\Http\Response
*/
public
function
create
(
$formName
,
CreateMenuRequest
$request
)
{
if
(
in_array
(
$formName
,
[
'_add_custom_url_form'
]))
{
return
view
(
'backend.menus.'
.
$formName
);
}
return
abort
(
404
);
}
}
\ No newline at end of file
app/Http/Controllers/Backend/Menu/MenuTableController.php
0 → 100644
View file @
43902b10
<?php
namespace
App\Http\Controllers\Backend\Menu
;
use
Illuminate\Http\Request
;
use
App\Http\Controllers\Controller
;
use
Yajra\DataTables\Facades\DataTables
;
use
App\Repositories\Backend\Menu\MenuRepository
;
use
App\Http\Requests\Backend\Menu\ManageMenuRequest
;
use
Carbon\Carbon
;
/**
* Class MenuTableController.
*/
class
MenuTableController
extends
Controller
{
protected
$menus
;
/**
* @param \App\Repositories\Backend\Menu\MenuRepository $menus
*/
public
function
__construct
(
MenuRepository
$menus
)
{
$this
->
menus
=
$menus
;
}
/**
* @param \App\Http\Requests\Backend\Menu\ManageMenuRequest $request
*
* @return mixed
*/
public
function
__invoke
(
ManageMenuRequest
$request
)
{
return
Datatables
::
of
(
$this
->
menus
->
getForDataTable
())
->
escapeColumns
([
'name'
])
->
addColumn
(
'type'
,
function
(
$menus
)
{
return
ucwords
(
$menus
->
type
);
})
->
addColumn
(
'created_at'
,
function
(
$menus
)
{
return
Carbon
::
parse
(
$menus
->
created_at
)
->
toDateTimeString
();
})
->
addColumn
(
'updated_at'
,
function
(
$menus
)
{
return
Carbon
::
parse
(
$menus
->
updated_at
)
->
toDateTimeString
();
})
->
addColumn
(
'actions'
,
function
(
$menus
)
{
return
$menus
->
action_buttons
;
})
->
make
(
true
);
}
}
app/Http/Requests/Backend/Menu/CreateMenuRequest.php
0 → 100644
View file @
43902b10
<?php
namespace
App\Http\Requests\Backend\Menu
;
use
App\Http\Requests\Request
;
/**
* Class CreateMenuRequest
*/
class
CreateMenuRequest
extends
Request
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public
function
authorize
()
{
return
access
()
->
allow
(
'create-menu'
);
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public
function
rules
()
{
return
[
//
];
}
}
app/Http/Requests/Backend/Menu/DeleteMenuRequest.php
0 → 100644
View file @
43902b10
<?php
namespace
App\Http\Requests\Backend\Menu
;
use
App\Http\Requests\Request
;
/**
* Class DeleteMenuRequest
*/
class
DeleteMenuRequest
extends
Request
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public
function
authorize
()
{
return
access
()
->
allow
(
'delete-menu'
);
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public
function
rules
()
{
return
[
//
];
}
}
app/Http/Requests/Backend/Menu/EditMenuRequest.php
0 → 100644
View file @
43902b10
<?php
namespace
App\Http\Requests\Backend\Menu
;
use
App\Http\Requests\Request
;
/**
* Class EditMenuRequest
*/
class
EditMenuRequest
extends
Request
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public
function
authorize
()
{
return
access
()
->
allow
(
'edit-menu'
);
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public
function
rules
()
{
return
[
//
];
}
}
app/Http/Requests/Backend/Menu/ManageMenuRequest.php
0 → 100644
View file @
43902b10
<?php
namespace
App\Http\Requests\Backend\Menu
;
use
App\Http\Requests\Request
;
/**
* Class ManageMenuRequest.
*/
class
ManageMenuRequest
extends
Request
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public
function
authorize
()
{
return
access
()
->
allow
(
'view-menu'
);
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public
function
rules
()
{
return
[
//
];
}
}
app/Http/Requests/Backend/Menu/StoreMenuRequest.php
0 → 100644
View file @
43902b10
<?php
namespace
App\Http\Requests\Backend\Menu
;
use
App\Http\Requests\Request
;
/**
* Class StoreMenuRequest.
*/
class
StoreMenuRequest
extends
Request
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public
function
authorize
()
{
return
access
()
->
allow
(
'create-menu'
);
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public
function
rules
()
{
return
[
'name'
=>
'required'
,
'type'
=>
'required'
,
];
}
}
app/Http/Requests/Backend/Menu/UpdateMenuRequest.php
0 → 100644
View file @
43902b10
<?php
namespace
App\Http\Requests\Backend\Menu
;
use
App\Http\Requests\Request
;
/**
* Class UpdateMenuRequest.
*/
class
UpdateMenuRequest
extends
Request
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public
function
authorize
()
{
return
access
()
->
allow
(
'edit-menu'
);
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public
function
rules
()
{
return
[
'name'
=>
'required'
,
'type'
=>
'required'
,
];
}
}
app/Models/Menu/Menu.php
0 → 100644
View file @
43902b10
<?php
namespace
App\Models\Menu
;
use
Illuminate\Database\Eloquent\Model
;
use
App\Models\ModelTrait
;
use
App\Models\Menu\Traits\Attribute\MenuAttribute
;
use
Illuminate\Database\Eloquent\SoftDeletes
;
class
Menu
extends
Model
{
use
ModelTrait
,
MenuAttribute
,
SoftDeletes
{
// MenuAttribute::getEditButtonAttribute insteadof ModelTrait;
}
/**
* The database table used by the model.
*
* @var string
*/
protected
$table
;
protected
$fillable
=
[
'name'
,
'type'
,
'items'
];
public
function
__construct
(
array
$attributes
=
[])
{
parent
::
__construct
(
$attributes
);
$this
->
table
=
config
(
"access.menus_table"
);
}
}
app/Models/Menu/Traits/Attribute/MenuAttribute.php
0 → 100644
View file @
43902b10
<?php
namespace
App\Models\Menu\Traits\Attribute
;
/**
* Class MenuAttribute.
*/
trait
MenuAttribute
{
/**
* @return string
*/
public
function
getActionButtonsAttribute
()
{
return
'<div class="btn-group action-btn">
'
.
$this
->
getEditButtonAttribute
(
'edit-menu'
,
'admin.menus.edit'
)
.
'
'
.
$this
->
getDeleteButtonAttribute
(
'delete-menu'
,
'admin.menus.destroy'
)
.
'
</div>'
;
}
}
app/Repositories/Backend/Menu/MenuRepository.php
0 → 100644
View file @
43902b10
<?php
namespace
App\Repositories\Backend\Menu
;
use
App\Repositories\BaseRepository
;
use
App\Exceptions\GeneralException
;
use
App\Models\Menu\Menu
;
use
Illuminate\Database\Eloquent\Model
;
use
DB
;
/**
* Class MenuRepository.
*/
class
MenuRepository
extends
BaseRepository
{
/**
* Associated Repository Model.
*/
const
MODEL
=
Menu
::
class
;
/**
* @return mixed
*/
public
function
getForDataTable
()
{
return
$this
->
query
()
->
select
([
config
(
'access.menus_table'
)
.
'.id'
,
config
(
'access.menus_table'
)
.
'.name'
,
config
(
'access.menus_table'
)
.
'.type'
,
config
(
'access.menus_table'
)
.
'.created_at'
,
config
(
'access.menus_table'
)
.
'.updated_at'
,
]);
}
/**
* @param array $input
*
* @throws \App\Exceptions\GeneralException
*
* @return bool
*/
public
function
create
(
array
$input
)
{
if
(
$this
->
query
()
->
where
(
'name'
,
$input
[
'name'
])
->
first
())
{
throw
new
GeneralException
(
trans
(
'exceptions.backend.menus.already_exists'
));
}
$input
[
'created_by'
]
=
access
()
->
user
()
->
id
;
if
(
Menu
::
create
(
$input
))
{
return
true
;
}
throw
new
GeneralException
(
trans
(
'exceptions.backend.menus.create_error'
));
}
/**
* @param \App\Models\Menu\Menu $menu
* @param $input
*
* @throws \App\Exceptions\GeneralException
*
* return bool
*/
public
function
update
(
Menu
$menu
,
array
$input
)
{
if
(
$this
->
query
()
->
where
(
'name'
,
$input
[
'name'
])
->
where
(
"id"
,
'!='
,
$menu
->
id
)
->
first
())
{
throw
new
GeneralException
(
trans
(
'exceptions.backend.menus.already_exists'
));
}
$input
[
'updated_by'
]
=
access
()
->
user
()
->
id
;
if
(
$menu
->
update
(
$input
))
{
return
true
;
}
throw
new
GeneralException
(
trans
(
'exceptions.backend.menus.update_error'
));
}
/**
* @param \App\Models\Menu\Menu $menu
*
* @throws \App\Exceptions\GeneralException
*
* @return bool
*/
public
function
delete
(
Menu
$menu
)
{
if
(
$menu
->
delete
())
{
return
true
;
}
throw
new
GeneralException
(
trans
(
'exceptions.backend.menus.delete_error'
));
}
}
\ No newline at end of file
composer.json
View file @
43902b10
...
...
@@ -51,8 +51,7 @@
"Tests
\\
"
:
"tests/"
},
"classmap"
:
[
"tests/TestCase.php"
,
"tests/BrowserKitTestCase.php"
"tests/TestCase.php"
]
},
"scripts"
:
{
...
...
database/migrations/2017_12_10_122555_create_menus_table.php
0 → 100644
View file @
43902b10
<?php
use
Illuminate\Support\Facades\Schema
;
use
Illuminate\Database\Schema\Blueprint
;
use
Illuminate\Database\Migrations\Migration
;
class
CreateMenusTable
extends
Migration
{
/**
* Run the migrations.
*
* @return void
*/
public
function
up
()
{
Schema
::
create
(
'menus'
,
function
(
Blueprint
$table
)
{
$table
->
increments
(
'id'
)
->
unsigned
();
$table
->
enum
(
'type'
,
[
'backend'
,
'frontend'
]);
$table
->
string
(
'name'
);
$table
->
text
(
'items'
)
->
nullable
();
$table
->
integer
(
'created_by'
)
->
unsigned
();
$table
->
integer
(
'updated_by'
)
->
unsigned
()
->
nullable
();
$table
->
timestamps
();
$table
->
softDeletes
();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public
function
down
()
{
Schema
::
dropIfExists
(
'menus'
);
}
}
database/seeds/MenuTableSeeder.php
0 → 100644
View file @
43902b10
<?php
use
Carbon\Carbon
;
use
Database\TruncateTable
;
use
Illuminate\Database\Seeder
;
use
Illuminate\Support\Facades\DB
;
class
MenuTableSeeder
extends
Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public
function
run
()
{
DB
::
table
(
config
(
'access.menus_table'
))
->
truncate
();
$menu
=
[
'id'
=>
1
,
'type'
=>
'backend'
,
'name'
=>
"Backend Sidebar Menu"
,
'items'
=>
'[{"view_permission_id":"view-access-management","icon":"fa-users","open_in_new_tab":0,"url_type":"route","url":"","name":"Access Management","id":11,"content":"Access Management","children":[{"view_permission_id":"view-user-management","open_in_new_tab":0,"url_type":"route","url":"admin.access.user.index","name":"User Management","id":12,"content":"User Management"},{"view_permission_id":"view-role-management","open_in_new_tab":0,"url_type":"route","url":"admin.access.role.index","name":"Role Management","id":13,"content":"Role Management"},{"view_permission_id":"view-permission-management","open_in_new_tab":0,"url_type":"route","url":"admin.access.permission.index","name":"Permission Management","id":14,"content":"Permission Management"}]},{"view_permission_id":"view-module","icon":"fa-wrench","open_in_new_tab":0,"url_type":"route","url":"admin.modules.index","name":"Module","id":1,"content":"Module"},{"view_permission_id":"view-menu","icon":"fa-bars","open_in_new_tab":0,"url_type":"route","url":"admin.menus.index","name":"Menus","id":3,"content":"Menus"},{"view_permission_id":"view-page","icon":"fa-file-text","open_in_new_tab":0,"url_type":"route","url":"admin.pages.index","name":"Pages","id":2,"content":"Pages"},{"view_permission_id":"view-email-template","icon":"fa-envelope","open_in_new_tab":0,"url_type":"route","url":"admin.emailtemplates.index","name":"Email Templates","id":8,"content":"Email Templates"},{"view_permission_id":"edit-settings","icon":"fa-gear","open_in_new_tab":0,"url_type":"route","url":"admin.settings.edit?id=1","name":"Settings","id":9,"content":"Settings"},{"view_permission_id":"view-blog","icon":"fa-commenting","open_in_new_tab":0,"url_type":"route","url":"","name":"Blog Management","id":15,"content":"Blog Management","children":[{"view_permission_id":"view-blog-category","open_in_new_tab":0,"url_type":"route","url":"admin.blogcategories.index","name":"Blog Category Management","id":16,"content":"Blog Category Management"},{"view_permission_id":"view-blog-tag","open_in_new_tab":0,"url_type":"route","url":"admin.blogtags.index","name":"Blog Tag Management","id":17,"content":"Blog Tag Management"},{"view_permission_id":"view-blog","open_in_new_tab":0,"url_type":"route","url":"admin.blogs.index","name":"Blog Management","id":18,"content":"Blog Management"}]},{"view_permission_id":"view-faq","icon":"fa-question-circle","open_in_new_tab":0,"url_type":"route","url":"admin.faqs.index","name":"Faq Management","id":19,"content":"Faq Management"}]'
,
'created_by'
=>
1
,
'created_at'
=>
Carbon
::
now
()
];
DB
::
table
(
config
(
'access.menus_table'
))
->
insert
(
$menu
);
}
}
database/seeds/ModulesTableSeeder.php
0 → 100644
View file @
43902b10
<?php
use
Carbon\Carbon
;
use
Illuminate\Database\Seeder
;
use
Illuminate\Support\Facades\DB
;
class
ModulesTableSeeder
extends
Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public
function
run
()
{
DB
::
table
(
'modules'
)
->
truncate
();
$modules
=
[
[
'name'
=>
trans
(
'menus.backend.access.title'
),
'url'
=>
null
,
'view_permission_id'
=>
'view-access-management'
,
'created_by'
=>
1
,
'created_at'
=>
Carbon
::
now
()
],
[
'name'
=>
trans
(
'labels.backend.access.users.management'
),
'url'
=>
'admin.access.user.index'
,
'view_permission_id'
=>
'view-user-management'
,
'created_by'
=>
1
,
'created_at'
=>
Carbon
::
now
()
],
[
'name'
=>
trans
(
'labels.backend.access.roles.management'
),
'url'
=>
'admin.access.role.index'
,
'view_permission_id'
=>
'view-role-management'
,
'created_by'
=>
1
,
'created_at'
=>
Carbon
::
now
()
],
[
'name'
=>
trans
(
'labels.backend.access.permissions.management'
),
'url'
=>
'admin.access.permission.index'
,
'view_permission_id'
=>
'view-permission-management'
,
'created_by'
=>
1
,
'created_at'
=>
Carbon
::
now
()
],
[
'name'
=>
trans
(
'labels.backend.menus.title'
),
'url'
=>
'admin.menus.index'
,
'view_permission_id'
=>
'view-menu'
,
'created_by'
=>
1
,
'created_at'
=>
Carbon
::
now
()
],
[
'name'
=>
trans
(
'labels.backend.modules.title'
),
'url'
=>
'admin.modules.index'
,
'view_permission_id'
=>
'view-module'
,
'created_by'
=>
1
,
'created_at'
=>
Carbon
::
now
()
],
[
'name'
=>
trans
(
'labels.backend.pages.title'
),
'url'
=>
'admin.pages.index'
,
'view_permission_id'
=>
'view-page'
,
'created_by'
=>
1
,
'created_at'
=>
Carbon
::
now
()
],
[
'name'
=>
trans
(
'labels.backend.emailtemplates.title'
),
'url'
=>
'admin.emailtemplates.index'
,
'view_permission_id'
=>
'view-email-template'
,
'created_by'
=>
1
,
'created_at'
=>
Carbon
::
now
()
],
[
'name'
=>
trans
(
'labels.backend.settings.title'
),
'url'
=>
'admin.settings.edit'
,
'view_permission_id'
=>
'edit-settings'
,
'created_by'
=>
1
,
'created_at'
=>
Carbon
::
now
()
],
[
'name'
=>
trans
(
'menus.backend.blog.management'
),
'url'
=>
null
,
'view_permission_id'
=>
'view-blog'
,
'created_by'
=>
1
,
'created_at'
=>
Carbon
::
now
()
],
[
'name'
=>
trans
(
'menus.backend.blogcategories.management'
),
'url'
=>
'admin.blogcategories.index'
,
'view_permission_id'
=>
'view-blog-category'
,
'created_by'
=>
1
,
'created_at'
=>
Carbon
::
now
()
],
[
'name'
=>
trans
(
'menus.backend.blogtags.management'
),
'url'
=>
'admin.blogtags.index'
,
'view_permission_id'
=>
'view-blog-tag'
,
'created_by'
=>
1
,
'created_at'
=>
Carbon
::
now
()
],
[
'name'
=>
trans
(
'menus.backend.blog.management'
),
'url'
=>
'admin.blogs.index'
,
'view_permission_id'
=>
'view-blog'
,
'created_by'
=>
1
,
'created_at'
=>
Carbon
::
now
()
],
[
'name'
=>
trans
(
'menus.backend.faqs.management'
),
'url'
=>
'admin.faqs.index'
,
'view_permission_id'
=>
'view-faq'
,
'created_by'
=>
1
,
'created_at'
=>
Carbon
::
now
()
],
];
DB
::
table
(
'modules'
)
->
insert
(
$modules
);
}
}
resources/views/backend/layouts/app.blade.php
View file @
43902b10
...
...
@@ -46,7 +46,7 @@
<div
class=
"wrapper"
>
@include('backend.includes.header')
@include('backend.includes.sidebar')
@include('backend.includes.sidebar
-dynamic
')
<!-- Content Wrapper. Contains page content -->
<div
class=
"content-wrapper"
>
...
...
resources/views/backend/menus/_add_custom_url_form.blade.php
0 → 100644
View file @
43902b10
{{
Form
::
open
([
'class'
=>
'form-horizontal hidden'
,
'role'
=>
'form'
,
'method'
=>
'post'
,
'id'
=>
'menu-add-custom-url'
])
}}
<
div
class
="
form
-
group
">
{{ Form::label('name', trans('labels.backend.menus.field.name'), ['class' => 'col-lg-3 col-md-3 col-sm-3 control-label required']) }}
<div class="
col
-
lg
-
9
col
-
md
-
9
col
-
sm
-
9
">
{{ Form::text('name', null, ['class' => 'form-control box-size mi-name', 'id' => '', 'placeholder' => trans('labels.backend.menus.field.name'), 'required' => 'required']) }}
</div>
</div>
<div class="
form
-
group
">
{{ Form::label('url', trans('labels.backend.menus.field.url'), ['class' => 'col-lg-3 col-md-3 col-sm-3 control-label']) }}
<div class="
col
-
lg
-
9
col
-
md
-
9
col
-
sm
-
9
">
{{ Form::text('url', null, ['class' => 'form-control box-size mi-url', 'placeholder' => trans('labels.backend.menus.field.url')]) }}
</div>
</div>
<div class="
form
-
group
">
{{ Form::label('url', trans('labels.backend.menus.field.url_type'), ['class' => 'col-lg-3 col-md-3 col-sm-3 control-label']) }}
<div class="
col
-
lg
-
9
col
-
md
-
9
col
-
sm
-
9
">
<div class="
radio
">
<label class="
radio
-
inline
">{{ Form::radio('url_type', 'route', null, ['class' => 'mi-url_type_route']) }} {{ trans('labels.backend.menus.field.url_types.route') }}</label>
<label class="
radio
-
inline
">{{ Form::radio('url_type', 'static', true, ['class' => 'mi-url_type_static']) }} {{ trans('labels.backend.menus.field.url_types.static') }}</label>
</div>
<div class="
checkbox
">
{{ Form::hidden('open_in_new_tab', 0) }}
<label>
{{ Form::checkbox('open_in_new_tab', 1, false, ['class' => 'mi-open_in_new_tab']) }} {{ trans('labels.backend.menus.field.open_in_new_tab') }}
</label>
</div>
</div>
</div>
<div class="
form
-
group
">
{{ Form::label('icon', trans('labels.backend.menus.field.icon'), ['class' => 'col-lg-3 col-md-3 col-sm-3 control-label', 'title' => trans('labels.backend.menus.field.icon_title')]) }}
<div class="
col
-
lg
-
9
col
-
md
-
9
col
-
sm
-
9
">
{{ Form::text('icon', null, ['class' => 'form-control box-size mi-icon', 'placeholder' => trans('labels.backend.menus.field.icon_title')]) }}
</div>
</div>
<div class="
form
-
group
view
-
permission
-
block
">
{{ Form::label('view_permission_id', trans('labels.backend.menus.field.view_permission_id'), ['class' => 'col-lg-3 col-md-3 col-sm-3 control-label']) }}
<div class="
col
-
lg
-
9
col
-
md
-
9
col
-
sm
-
9
">
{{ Form::text('view_permission_id', null, ['class' => 'form-control box-size mi-view_permission_id', 'placeholder' => trans('labels.backend.menus.field.view_permission_id')]) }}
</div>
</div>
{{ Form::hidden('id', null, ['class' => 'mi-id']) }}
<div class="
box
-
body
">
<div class="
form
-
group
">
<div class="
edit
-
form
-
btn
">
{{ Form::reset(trans('buttons.general.cancel'), ['class' => 'btn btn-default btn-md', 'data-dismiss' => 'modal']) }}
{{ Form::submit(trans('buttons.general.save'), ['class' => 'btn btn-primary btn-md']) }}
<div class="
clearfix
"></div>
</div>
</div>
</div>
{{ Form::close() }}
resources/views/backend/menus/create.blade.php
0 → 100644
View file @
43902b10
@
extends
(
'backend.layouts.app'
)
@
section
(
'title'
,
trans
(
'labels.backend.menus.management'
)
.
' | '
.
trans
(
'labels.backend.menus.create'
))
@
section
(
'page-header'
)
<
h1
>
{{
trans
(
'labels.backend.menus.management'
)
}}
<
small
>
{{
trans
(
'labels.backend.menus.create'
)
}}
</
small
>
</
h1
>
@
endsection
@
section
(
'content'
)
{{
Form
::
open
([
'route'
=>
'admin.menus.store'
,
'class'
=>
'form-horizontal'
,
'role'
=>
'form'
,
'method'
=>
'post'
,
'id'
=>
'create-menu'
,
'files'
=>
false
])
}}
<
div
class
="
box
box
-
info
">
<div class="
box
-
header
with
-
border
">
<h3 class="
box
-
title
">{{ trans('labels.backend.menus.create') }}</h3>
<div class="
box
-
tools
pull
-
right
">
@include('backend.menus.partials.header-buttons')
</div><!--box-tools pull-right-->
</div><!-- /.box-header -->
{{-- Including Form blade file --}}
<div class="
box
-
body
">
<div class="
form
-
group
">
@include("
backend
.
menus
.
form
")
<div class="
edit
-
form
-
btn
">
{{ link_to_route('admin.menus.index', trans('buttons.general.cancel'), [], ['class' => 'btn btn-danger btn-md']) }}
{{ Form::submit(trans('buttons.general.crud.create'), ['class' => 'btn btn-primary btn-md']) }}
<div class="
clearfix
"></div>
</div>
</div>
</div><!--box-->
</div>
{{ Form::close() }}
@include("
backend
.
menus
.
partials
.
modal
")
@endsection
resources/views/backend/menus/edit.blade.php
0 → 100644
View file @
43902b10
@
extends
(
'backend.layouts.app'
)
@
section
(
'title'
,
trans
(
'labels.backend.menus.management'
)
.
' | '
.
trans
(
'labels.backend.menus.edit'
))
@
section
(
'page-header'
)
<
h1
>
{{
trans
(
'labels.backend.menus.management'
)
}}
<
small
>
{{
trans
(
'labels.backend.menus.edit'
)
}}
</
small
>
</
h1
>
@
endsection
@
section
(
'content'
)
{{
Form
::
model
(
$menu
,
[
'route'
=>
[
'admin.menus.update'
,
$menu
],
'class'
=>
'form-horizontal'
,
'role'
=>
'form'
,
'method'
=>
'PATCH'
,
'id'
=>
'edit-role'
,
'files'
=>
true
])
}}
<
div
class
="
box
box
-
info
">
<div class="
box
-
header
with
-
border
">
<h3 class="
box
-
title
">{{ trans('labels.backend.menus.edit') }}</h3>
<div class="
box
-
tools
pull
-
right
">
@include('backend.menus.partials.header-buttons')
</div><!--box-tools pull-right-->
</div><!-- /.box-header -->
{{-- Including Form blade file --}}
<div class="
box
-
body
">
<div class="
form
-
group
">
@include("
backend
.
menus
.
form
")
<div class="
edit
-
form
-
btn
">
{{ link_to_route('admin.menus.index', trans('buttons.general.cancel'), [], ['class' => 'btn btn-danger btn-md']) }}
{{ Form::submit(trans('buttons.general.crud.update'), ['class' => 'btn btn-primary btn-md']) }}
<div class="
clearfix
"></div>
</div>
</div>
</div><!--box-->
</div>
{{ Form::close() }}
@include("
backend
.
menus
.
partials
.
modal
")
@endsection
\ No newline at end of file
resources/views/backend/menus/form.blade.php
0 → 100644
View file @
43902b10
This diff is collapsed.
Click to expand it.
resources/views/backend/menus/index.blade.php
0 → 100644
View file @
43902b10
@
extends
(
'backend.layouts.app'
)
@
section
(
'title'
,
trans
(
'labels.backend.menus.management'
))
@
section
(
'after-styles'
)
{{
Html
::
style
(
"css/backend/plugin/datatables/dataTables.bootstrap.min.css"
)
}}
@
endsection
@
section
(
'page-header'
)
<
h1
>
{{
trans
(
'labels.backend.menus.management'
)
}}
</
h1
>
@
endsection
@
section
(
'content'
)
<
div
class
="
box
box
-
info
">
<div class="
box
-
header
with
-
border
">
<h3 class="
box
-
title
">{{ trans('labels.backend.menus.management') }}</h3>
<div class="
box
-
tools
pull
-
right
">
@include('backend.menus.partials.header-buttons')
</div>
</div><!-- /.box-header -->
<div class="
box
-
body
">
<div class="
table
-
responsive
data
-
table
-
wrapper
">
<table id="
menus
-
table
" class="
table
table
-
condensed
table
-
hover
table
-
bordered
">
<thead>
<tr>
<th>{{ trans('labels.backend.menus.table.name') }}</th>
<th>{{ trans('labels.backend.menus.table.type') }}</th>
<th>{{ trans('labels.backend.menus.table.createdat') }}</th>
<th>{{ trans('labels.general.actions') }}</th>
</tr>
</thead>
<thead class="
transparent
-
bg
">
<tr>
<th>
{!! Form::text('first_name', null, ["
class
"
=>
"
search
-
input
-
text
form
-
control
", "
data
-
column
" => 0, "
placeholder
" => trans('labels.backend.menus.table.name')]) !!}
<a class="
reset
-
data
" href="
javascript
:
void
(
0
)
"><i class="
fa
fa
-
times
"></i></a>
</th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
</table>
</div><!--table-responsive-->
</div><!-- /.box-body -->
</div><!--box-->
<!--<div class="
box
box
-
info
">
<div class="
box
-
header
with
-
border
">
<h3 class="
box
-
title
">{{ trans('history.backend.recent_history') }}</h3>
<div class="
box
-
tools
pull
-
right
">
<button class="
btn
btn
-
box
-
tool
" data-widget="
collapse
"><i class="
fa
fa
-
minus
"></i></button>
</div><!-- /.box tools -->
</div><!-- /.box-header -->
<div class="
box
-
body
">
{{-- {!! history()->renderType('Blog') !!} --}}
</div><!-- /.box-body -->
</div><!--box box-success-->
@endsection
@section('after-scripts')
{{-- For DataTables --}}
@include('includes.datatables')
<script>
$(function() {
var dataTable = $('#menus-table').dataTable({
processing: true,
serverSide: true,
ajax: {
url: '{{ route("
admin
.
menus
.
get
") }}',
type: 'post'
},
columns: [
{data: 'name', name: '
{
{config('access.menus_table')}}.name'
}
,
{data: 'type', name: '
{
{config('access.menus_table')}}.type'
}
,
{data: 'created_at', name: '
{
{config('access.menus_table')}}.created_at'
}
,
{data: 'actions', name: 'actions', searchable: false, sortable: false}
],
order: [[3, "
asc
"]],
searchDelay: 500,
dom: 'lBfrtip',
buttons: {
buttons: [
{ extend: 'copy', className: 'copyButton', exportOptions: {columns: [ 0, 1, 2, 3, 4 ] }},
{ extend: 'csv', className: 'csvButton', exportOptions: {columns: [ 0, 1, 2, 3, 4 ] }},
{ extend: 'excel', className: 'excelButton', exportOptions: {columns: [ 0, 1, 2, 3, 4 ] }},
{ extend: 'pdf', className: 'pdfButton', exportOptions: {columns: [ 0, 1, 2, 3, 4 ] }},
{ extend: 'print', className: 'printButton', exportOptions: {columns: [ 0, 1, 2, 3, 4 ] }}
]
}
});
FinBuilders.DataTableSearch.init(dataTable);
});
</script>
@endsection
\ No newline at end of file
resources/views/backend/menus/partials/header-buttons.blade.php
0 → 100644
View file @
43902b10
<!--Action Button-->
@if(Active::checkUriPattern('admin/menus'))
<div
class=
"btn-group"
>
<button
type=
"button"
class=
"btn btn-warning btn-flat dropdown-toggle"
data-toggle=
"dropdown"
>
Export
<span
class=
"caret"
></span>
<span
class=
"sr-only"
>
Toggle Dropdown
</span>
</button>
<ul
class=
"dropdown-menu"
role=
"menu"
>
<li
id=
"copyButton"
><a
href=
"#"
><i
class=
"fa fa-clone"
></i>
Copy
</a></li>
<li
id=
"csvButton"
><a
href=
"#"
><i
class=
"fa fa-file-text-o"
></i>
CSV
</a></li>
<li
id=
"excelButton"
><a
href=
"#"
><i
class=
"fa fa-file-excel-o"
></i>
Excel
</a></li>
<li
id=
"pdfButton"
><a
href=
"#"
><i
class=
"fa fa-file-pdf-o"
></i>
PDF
</a></li>
<li
id=
"printButton"
><a
href=
"#"
><i
class=
"fa fa-print"
></i>
Print
</a></li>
</ul>
</div>
@endif
<!--Action Button-->
<div
class=
"btn-group"
>
<button
type=
"button"
class=
"btn btn-primary btn-flat dropdown-toggle"
data-toggle=
"dropdown"
>
Action
<span
class=
"caret"
></span>
<span
class=
"sr-only"
>
Toggle Dropdown
</span>
</button>
<ul
class=
"dropdown-menu"
role=
"menu"
>
<li><a
href=
"{{route('admin.menus.index')}}"
><i
class=
"fa fa-list-ul"
></i>
{{trans('menus.backend.menus.all')}}
</a></li>
@permission('create-menu')
<li><a
href=
"{{route('admin.menus.create')}}"
><i
class=
"fa fa-plus"
></i>
{{trans('menus.backend.menus.create')}}
</a></li>
@endauth
</ul>
</div>
<div
class=
"clearfix"
></div>
\ No newline at end of file
resources/views/backend/menus/partials/modal.blade.php
0 → 100644
View file @
43902b10
<div
id=
"showMenuModal"
class=
"modal fade"
role=
"dialog"
>
<div
class=
"modal-dialog"
>
<!-- Modal content-->
<div
class=
"modal-content"
>
<div
class=
"modal-header"
>
<button
type=
"button"
class=
"close"
data-dismiss=
"modal"
>
×
</button>
<h4
class=
"modal-title"
></h4>
</div>
<div
class=
"modal-body"
>
<p>
Something went wrong! Please try again later.
</p>
</div>
</div>
</div>
</div>
\ No newline at end of file
resources/views/vendor/generator/create.blade.php
View file @
43902b10
...
...
@@ -12,7 +12,7 @@
@
section
(
'content'
)
{{
Form
::
open
([
'route'
=>
'admin.modules.store'
,
'class'
=>
'form-horizontal'
,
'role'
=>
'form'
,
'method'
=>
'post'
,
'id'
=>
'create-module'
,
'files'
=>
true
])
}}
<
div
class
="
box
box
-
success
">
<
div
class
="
box
box
-
info
">
<div class="
box
-
header
with
-
border
">
<h3 class="
box
-
title
">{{ trans('generator::labels.modules.create') }}</h3>
...
...
resources/views/vendor/generator/edit.blade.php
View file @
43902b10
...
...
@@ -12,7 +12,7 @@
@
section
(
'content'
)
{{
Form
::
model
(
$module
,
[
'route'
=>
[
'admin.modules.update'
,
$module
],
'class'
=>
'form-horizontal'
,
'role'
=>
'form'
,
'method'
=>
'PATCH'
,
'id'
=>
'edit-module'
,
'files'
=>
true
])
}}
<
div
class
="
box
box
-
success
">
<
div
class
="
box
box
-
info
">
<div class="
box
-
header
with
-
border
">
<h3 class="
box
-
title
">{{ trans('generator::labels.modules.edit') }}</h3>
...
...
resources/views/vendor/generator/index.blade.php
View file @
43902b10
...
...
@@ -7,7 +7,7 @@
@
endsection
@
section
(
'content'
)
<
div
class
="
box
box
-
success
">
<
div
class
="
box
box
-
info
">
<div class="
box
-
header
with
-
border
">
<h3 class="
box
-
title
">{{ trans('labels.backend.modules.management') }}</h3>
...
...
routes/Backend/Menu.php
0 → 100644
View file @
43902b10
<?php
/**
* Menu Management
*/
Route
::
group
([
'namespace'
=>
'Menu'
],
function
()
{
Route
::
resource
(
'menus'
,
'MenuController'
,
[
'except'
=>
[]]);
//For DataTables
Route
::
post
(
'menus/get'
,
'MenuTableController'
)
->
name
(
'menus.get'
);
// for Model Forms
Route
::
get
(
'menus/get-form/{name?}'
,
'MenuFormController@create'
)
->
name
(
'menus.getform'
);
});
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment