Ejemplo n.º 1
0
 /**
  * Show new menu creation page
  * @return \Illuminate\View\View
  */
 public function createCrud()
 {
     $fieldTypes = FieldsDescriber::types();
     $fieldValidation = FieldsDescriber::validation();
     $defaultValuesCbox = FieldsDescriber::default_cbox();
     $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::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';
         } else {
             $tableName = strtolower($menu->name);
         }
         $models[$menu->id] = Schema::getColumnListing($tableName);
     }
     return view("qa::menus.createCrud", compact('fieldTypes', 'fieldValidation', 'defaultValuesCbox', 'menusSelect', 'models', 'parentsSelect', 'roles'));
 }