Skip to content

Commit

Permalink
create developers menu
Browse files Browse the repository at this point in the history
  • Loading branch information
gheav committed Sep 9, 2021
1 parent 18a9177 commit df79db8
Show file tree
Hide file tree
Showing 8 changed files with 95 additions and 11 deletions.
10 changes: 7 additions & 3 deletions app/Config/Routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,30 +31,34 @@

// We get a performance increase by specifying the default
// route since we don't have to scan directories.

//Common Routes
$routes->get('/', 'Welcome::index');
$routes->post('GetLogin', 'Welcome::index');
$routes->get('blocked', 'Welcome::forbiddenPage');
$routes->get('register', 'Welcome::register');
$routes->post('register', 'Welcome::registration');
$routes->get('home', 'Home::index');

// Setting Routes
$routes->get('users/userRoleAccess', 'Users::userRoleAccess');
$routes->post('users/createRole', 'Users::createRole');
$routes->post('users/updateRole', 'Users::updateRole');
$routes->delete('users/deleteRole', 'Users::deleteRole');

$routes->post('users/createMenuCategory', 'Users::createMenuCategory');
$routes->post('users/createMenu', 'Users::createMenu');
$routes->post('users/createSubMenu', 'Users::createSubMenu');

$routes->post('users/createUser', 'Users::createUser');
$routes->post('users/updateUser', 'Users::updateUser');
$routes->delete('users/deleteUser', 'Users::deleteUser');

$routes->post('users/changeMenuPermission', 'Users::changeMenuPermission');
$routes->post('users/changeMenuCategoryPermission', 'Users::changeMenuCategoryPermission');
$routes->post('users/changeSubMenuPermission', 'Users::changeSubMenuPermission');

//Developer Routes
$routes->get('menuManagement', 'Developers/MenuManagement::index');
$routes->get('crudGenerator', 'Developers/CRUDGenerator::index');

/*
* --------------------------------------------------------------------
* Additional Routing
Expand Down
16 changes: 16 additions & 0 deletions app/Controllers/Developers/CRUDGenerator.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace App\Controllers\Developers;

use App\Controllers\BaseController;

class CRUDGenerator extends BaseController
{
public function index()
{
$data = array_merge($this->data, [
'title' => 'CRUD Generator'
]);
return view('developers/crudGenerator.php', $data);
}
}
16 changes: 16 additions & 0 deletions app/Controllers/Developers/MenuManagement.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace App\Controllers\Developers;

use App\Controllers\BaseController;

class MenuManagement extends BaseController
{
public function index()
{
$data = array_merge($this->data, [
'title' => 'Menu Management'
]);
return view('developers/menuManagement.php', $data);
}
}
36 changes: 29 additions & 7 deletions app/Database/Seeds/UserAccess.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,45 @@ public function run()
[
'role_id' => 1,
'menu_category_id' => 1,
'menu_id' => ''
'menu_id' => 0,
'submenu_id' => 0
],
[
'role_id' => 1,
'menu_category_id' => '',
'menu_id' => 1
'menu_category_id' => 0,
'menu_id' => 1,
'submenu_id' => 0
],
[
'role_id' => 1,
'menu_category_id' => 2,
'menu_id' => ''
'menu_id' => 0,
'submenu_id' => 0
],
[
'role_id' => 1,
'menu_category_id' => '',
'menu_id' => 2
]
'menu_category_id' => 0,
'menu_id' => 2,
'submenu_id' => 0
],
[
'role_id' => 1,
'menu_category_id' => 3,
'menu_id' => 0,
'submenu_id' => 0
],
[
'role_id' => 1,
'menu_category_id' => 0,
'menu_id' => 3,
'submenu_id' => 0
],
[
'role_id' => 1,
'menu_category_id' => 0,
'menu_id' => 4,
'submenu_id' => 0
],
];
$this->db->table('user_access')->insertBatch($data);
}
Expand Down
16 changes: 15 additions & 1 deletion app/Database/Seeds/UserMenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,21 @@ public function run()
'url' => 'users',
'icon' => 'user',
'parent' => 0
]
],
[
'menu_category' => 3,
'title' => 'Menu Management',
'url' => 'menuManagement',
'icon' => 'command',
'parent' => 0
],
[
'menu_category' => 3,
'title' => 'CRUD Generator',
'url' => 'crudGenerator',
'icon' => 'code',
'parent' => 0
],
];
$this->db->table('user_menu')->insertBatch($data);
}
Expand Down
3 changes: 3 additions & 0 deletions app/Database/Seeds/UserMenuCategory.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ public function run()
],
[
'menu_category' => 'Settings'
],
[
'menu_category' => 'Developers'
]
];
$this->db->table('user_menu_category')->insertBatch($data);
Expand Down
4 changes: 4 additions & 0 deletions app/Views/developers/crudGenerator.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?= $this->extend('layouts/main'); ?>
<?= $this->section('content'); ?>
<h1 class="h3 mb-3"><strong><?= $title; ?></strong> Menu </h1>
<?= $this->endSection(); ?>
5 changes: 5 additions & 0 deletions app/Views/developers/menuManagement.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?= $this->extend('layouts/main'); ?>
<?= $this->section('content'); ?>
<h1 class="h3 mb-3"><strong><?= $title; ?></strong> Menu </h1>
<?= $this->endSection(); ?>

0 comments on commit df79db8

Please sign in to comment.