Esempio n. 1
0
 public function edit(Request $request)
 {
     if (AccessHelper::is_allowed()) {
         $menus = MenuModel::where('parent_id', '=', '0')->get();
         $aktip = MenuModel::where('id', '=', $request->id)->first();
         $routes = RoutesModel::all();
         return View("Base::menu_edit")->with('menus', $menus)->with('routes', $routes)->with('aktip', $aktip);
     } else {
         return \View('Base::Base.forbiden');
     }
 }
Esempio n. 2
0
 public function addmenutogroup_form(Request $request)
 {
     if (AccessHelper::is_allowed()) {
         $group = GroupModel::find($request->id);
         $users = UserModel::all();
         $groups = GroupModel::all();
         $routes = RoutesModel::all();
         $groupusers = GroupUserModel::where('group_id', '=', $request->id)->get();
         $menus = GroupUserMenuAccessModel::where('group_id', '=', $request->id)->get();
         $datas = GroupModel::userGroupName(\Auth::user()->id);
         $topMenuByGroup = MenuModel::getTopMenu(\Auth::user()->id);
         return View("Base::addmenutogroup_form")->with('group', $group)->with('users', $users)->with('groupusers', $groupusers)->with('routes', $routes)->with('menus', $menus)->with('datas', $datas)->with('topMenuByGroup', $topMenuByGroup);
     } else {
         return \View('Base::Base.forbiden');
     }
 }
Esempio n. 3
0
 /**
  * Will make sure that the required modules have been fully loaded
  * @return void
  */
 public function boot()
 {
     $lists = array_diff(scandir(app_path() . "/Addons"), array('..', '.'));
     foreach ($lists as $key => $value) {
         $__erp__ = app_path() . "/Addons/{$value}/__erp__.php";
         if (file_exists($__erp__)) {
             include $__erp__;
             $data = Addons::where('dir', '=', $value)->first();
             if ($data == null) {
                 if ($value == "Base") {
                     Addons::insert(["name" => $erp['name'], "version" => $erp['version'], "category" => $erp['category'], "description" => $erp['description'], "url" => $erp['website'], "dir" => $value, "is_installed" => "1", "author" => $erp['author']]);
                 } else {
                     Addons::insert(["name" => $erp['name'], "version" => $erp['version'], "category" => $erp['category'], "description" => $erp['description'], "url" => $erp['website'], "dir" => $value, "is_installed" => "0", "author" => $erp['author']]);
                 }
             }
         }
         // cek jika module sudah di install
         $is_installed = Addons::where('dir', '=', $value)->where('is_installed', '=', "1")->first();
         if ($is_installed) {
             // Load the routes for each of the addons
             if (file_exists(app_path() . "/Addons/{$value}/routes.php")) {
                 include app_path() . "/Addons/{$value}/routes.php";
             }
             // Load the views
             if (is_dir(app_path() . "/Addons/{$value}/Views")) {
                 $this->loadViewsFrom(app_path() . "/Addons/{$value}/Views", $value);
             }
             $total = count(RoutesModel::getRoutes()['data']['method']);
             for ($x = 0; $x < $total; $x++) {
                 $cekrut = RoutesModel::where('method', '=', RoutesModel::getRoutes()['data']['method'][$x])->where('route', '=', RoutesModel::getRoutes()['data']['path'][$x])->where('action', '=', RoutesModel::getRoutes()['data']['action'][$x])->first();
                 if ($cekrut == null) {
                     RoutesModel::insert(["method" => RoutesModel::getRoutes()['data']['method'][$x], "route" => RoutesModel::getRoutes()['data']['path'][$x], "action" => RoutesModel::getRoutes()['data']['action'][$x]]);
                 }
             }
         }
     }
 }