Skip to content

Commit

Permalink
Added default field to relationship select
Browse files Browse the repository at this point in the history
Only CRUDS can be selected as a relationship
  • Loading branch information
ModestasV committed Dec 16, 2015
1 parent fd25533 commit 3e7852c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"email": "[email protected]"
}
],
"version": "0.4.3",
"version": "0.4.4",
"require": {
"illuminate/html": "5.0.*@dev",
"intervention/image": "^2.3",
Expand Down
2 changes: 1 addition & 1 deletion src/Builders/ControllerBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public function relationshipsBuilder()
. ucfirst(Str::camel($menu->name))
. '::lists("'
. $field->relationship_field
. '", "id");'
. '", "id")->prepend(\'Please select\', \'\');'
. "\r\n";
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/Controllers/QuickadminMenuController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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');
Expand Down

0 comments on commit 3e7852c

Please sign in to comment.