diff --git a/composer.json b/composer.json index 597a0cd..19cfb1c 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ "email": "povilas@webcoderpro.com" } ], - "version": "0.4.3", + "version": "0.4.4", "require": { "illuminate/html": "5.0.*@dev", "intervention/image": "^2.3", diff --git a/src/Builders/ControllerBuilder.php b/src/Builders/ControllerBuilder.php index b2fe8dc..2dbe706 100644 --- a/src/Builders/ControllerBuilder.php +++ b/src/Builders/ControllerBuilder.php @@ -175,7 +175,7 @@ public function relationshipsBuilder() . ucfirst(Str::camel($menu->name)) . '::lists("' . $field->relationship_field - . '", "id");' + . '", "id")->prepend(\'Please select\', \'\');' . "\r\n"; } } diff --git a/src/Controllers/QuickadminMenuController.php b/src/Controllers/QuickadminMenuController.php index 00f8857..50f3da2 100644 --- a/src/Controllers/QuickadminMenuController.php +++ b/src/Controllers/QuickadminMenuController.php @@ -73,12 +73,12 @@ public function createCrud() $fieldTypes = FieldsDescriber::types(); $fieldValidation = FieldsDescriber::validation(); $defaultValuesCbox = FieldsDescriber::default_cbox(); - $menusSelect = Menu::lists('title', 'id'); + $menusSelect = Menu::whereNotIn('menu_type', [2, 3])->lists('title', 'id'); $roles = Role::all(); $parentsSelect = Menu::where('menu_type', 2)->lists('title', 'id')->prepend('-- no parent --', 'null'); // Get columns for relationship $models = []; - foreach (Menu::all() as $menu) { + foreach (Menu::whereNotIn('menu_type', [2, 3])->get() as $menu) { // We are having a default User model if ($menu->title == 'User' && $menu->is_menu == 0) { $tableName = 'users'; @@ -336,10 +336,10 @@ public function update(Request $request, $id) } $requestArray = $request->all(); if ($requestArray['parent_id'] === "null") { - $requestArray['parent_id'] = NULL; + $requestArray['parent_id'] = null; } $requestArray['roles'] = $rolesInsert; - $menu = Menu::findOrFail($id); + $menu = Menu::findOrFail($id); $menu->update($requestArray); return redirect()->route('menu');