src/Controllers/QuickadminMenuController.php
public function createCrud()
    {
        $fieldTypes        = FieldsDescriber::types();
        $fieldValidation   = FieldsDescriber::validation();
        $defaultValuesCbox = FieldsDescriber::default_cbox();
        $menusSelect       = Menu::whereNotIn('menu_type', [2, 3])->pluck('title', 'id');
        $roles             = Role::all();
        $parentsSelect     = Menu::where('menu_type', 2)->pluck('title', 'id')->prepend('-- no parent --', '');
        // 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'));
    }
public function createCrud()
    {
        $fieldTypes        = FieldsDescriber::types();
        $fieldValidation   = FieldsDescriber::validation();
        $defaultValuesCbox = FieldsDescriber::default_cbox();
        $menusSelect       = Menu::whereNotIn('menu_type', [2, 3])->pluck('title', 'id');
        $roles             = Role::all();
        $parentsSelect     = Menu::where('menu_type', 2)->pluck('title', 'id')->prepend('-- no parent --', '');
        // 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'));
    }
public function createCrud ( ) { $ fieldTypes = FieldsDescriber :: types ( ) ; $ fieldValidation = FieldsDescriber :: validation ( ) ; $ defaultValuesCbox = FieldsDescriber :: default_cbox ( ) ; $ menusSelect = Menu :: whereNotIn ( 'menu_type' , [ 2 , 3 ] ) -> pluck ( 'title' , 'id' ) ; $ roles = Role :: all ( ) ; $ parentsSelect = Menu :: where ( 'menu_type' , 2 ) -> pluck ( 'title' , 'id' ) -> prepend ( '-- no parent --' , '' ) ; // 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' ) ) ; }
Show new menu creation page
@return \Illuminate\View\View
Show new menu creation page