src/CrudGenerator.php
public static function create($config, $simple = false) {
        //$config = CrudGenerator::translateConfig($config);
        if (request()->has('_itemRelSel')) {
            list($itemsRelSelCampo, $itemsRelSelId) = explode("|", request()->_itemRelSel);
            foreach ($config['campos'] as $clave => $relacion) {
                if ($clave != $itemsRelSelCampo) {
                    unset($config['campos'][$clave]);
                }
            }
        }
        if (!CrudGenerator::checkPermission($config)) {
            return View::make('sirgrimorum::crudgen.error', ['message' => trans('crudgenerator::admin.messages.permission')]);
        }
        $modelo = strtolower(class_basename($config["modelo"]));
        $config = CrudGenerator::loadTodosFromConfig($config);

        if (!$simple) {
            $js_section = config("sirgrimorum.crudgenerator.js_section");
            $css_section = config("sirgrimorum.crudgenerator.css_section");
        } else {
            $js_section = "";
            $css_section = "";
        }
        if ($config['url'] == "Sirgrimorum_CrudAdministrator") {
            $config['url'] = route("sirgrimorum_modelo::store", ["modelo" => $modelo]);
            if (\Lang::has('crudgenerator::' . $modelo . '.labels.create')) {
                $config['botones'] = trans("crudgenerator::$modelo.labels.create");
            } else {
                $config['botones'] = trans("crudgenerator::admin.layout.crear");
            }
        }
        if (request()->has('_itemRelSel')) {
            $view = View::make('sirgrimorum::crudgen.templates.relationshipssel_simple', [
                        'config' => $config,
                        'datoId' => $itemsRelSelId,
                        'columna' => $itemsRelSelCampo,
                        'tabla' => (new $config['campos'][$itemsRelSelCampo]['modelo'])->getTable(),
                        'datos' => $config['campos'][$itemsRelSelCampo],
                        'js_section' => $js_section,
                        'css_section' => $css_section,
                        'modelo' => $modelo
            ]);
        } else {
            $view = View::make('sirgrimorum::crudgen.create', [
                        'config' => $config,
                        'tieneHtml' => CrudGenerator::hasTipo($config, ['html','article']),
                        'tieneDate' => CrudGenerator::hasTipo($config, ['date', 'datetime', 'time']),
                        'tieneSlider' => CrudGenerator::hasTipo($config, 'slider'),
                        'tieneSelect' => CrudGenerator::hasTipo($config, ['select', 'relationship', 'relationships']),
                        'tieneSearch' => CrudGenerator::hasTipo($config, [ 'relationshipssel']),
                        'tieneFile' => CrudGenerator::hasTipo($config, [ 'file', 'files']),
                        'tieneJson' => CrudGenerator::hasTipo($config, [ 'json']),
                        'js_section' => $js_section,
                        'css_section' => $css_section,
                        'modelo' => $modelo
            ]);
        }
        return $view->render();
    }
public static function create($config, $simple = false) {
        //$config = CrudGenerator::translateConfig($config);
        if (request()->has('_itemRelSel')) {
            list($itemsRelSelCampo, $itemsRelSelId) = explode("|", request()->_itemRelSel);
            foreach ($config['campos'] as $clave => $relacion) {
                if ($clave != $itemsRelSelCampo) {
                    unset($config['campos'][$clave]);
                }
            }
        }
        if (!CrudGenerator::checkPermission($config)) {
            return View::make('sirgrimorum::crudgen.error', ['message' => trans('crudgenerator::admin.messages.permission')]);
        }
        $modelo = strtolower(class_basename($config["modelo"]));
        $config = CrudGenerator::loadTodosFromConfig($config);

        if (!$simple) {
            $js_section = config("sirgrimorum.crudgenerator.js_section");
            $css_section = config("sirgrimorum.crudgenerator.css_section");
        } else {
            $js_section = "";
            $css_section = "";
        }
        if ($config['url'] == "Sirgrimorum_CrudAdministrator") {
            $config['url'] = route("sirgrimorum_modelo::store", ["modelo" => $modelo]);
            if (\Lang::has('crudgenerator::' . $modelo . '.labels.create')) {
                $config['botones'] = trans("crudgenerator::$modelo.labels.create");
            } else {
                $config['botones'] = trans("crudgenerator::admin.layout.crear");
            }
        }
        if (request()->has('_itemRelSel')) {
            $view = View::make('sirgrimorum::crudgen.templates.relationshipssel_simple', [
                        'config' => $config,
                        'datoId' => $itemsRelSelId,
                        'columna' => $itemsRelSelCampo,
                        'tabla' => (new $config['campos'][$itemsRelSelCampo]['modelo'])->getTable(),
                        'datos' => $config['campos'][$itemsRelSelCampo],
                        'js_section' => $js_section,
                        'css_section' => $css_section,
                        'modelo' => $modelo
            ]);
        } else {
            $view = View::make('sirgrimorum::crudgen.create', [
                        'config' => $config,
                        'tieneHtml' => CrudGenerator::hasTipo($config, ['html','article']),
                        'tieneDate' => CrudGenerator::hasTipo($config, ['date', 'datetime', 'time']),
                        'tieneSlider' => CrudGenerator::hasTipo($config, 'slider'),
                        'tieneSelect' => CrudGenerator::hasTipo($config, ['select', 'relationship', 'relationships']),
                        'tieneSearch' => CrudGenerator::hasTipo($config, [ 'relationshipssel']),
                        'tieneFile' => CrudGenerator::hasTipo($config, [ 'file', 'files']),
                        'tieneJson' => CrudGenerator::hasTipo($config, [ 'json']),
                        'js_section' => $js_section,
                        'css_section' => $css_section,
                        'modelo' => $modelo
            ]);
        }
        return $view->render();
    }
public static function create ( $ config , $ simple = false ) { //$config = CrudGenerator::translateConfig($config);
 if ( request ( ) -> has ( '_itemRelSel' ) ) { list ( $ itemsRelSelCampo , $ itemsRelSelId ) = explode ( "|" , request ( ) -> _itemRelSel ) ; foreach ( $ config [ 'campos' ] as $ clave => $ relacion ) { if ( $ clave != $ itemsRelSelCampo ) { unset ( $ config [ 'campos' ] [ $ clave ] ) ; } } } if ( ! CrudGenerator :: checkPermission ( $ config ) ) { return View :: make ( 'sirgrimorum::crudgen.error' , [ 'message' => trans ( 'crudgenerator::admin.messages.permission' ) ] ) ; } $ modelo = strtolower ( class_basename ( $ config [ "modelo" ] ) ) ; $ config = CrudGenerator :: loadTodosFromConfig ( $ config ) ; if ( ! $ simple ) { $ js_section = config ( "sirgrimorum.crudgenerator.js_section" ) ; $ css_section = config ( "sirgrimorum.crudgenerator.css_section" ) ; } else { $ js_section = "" ; $ css_section = "" ; } if ( $ config [ 'url' ] == "Sirgrimorum_CrudAdministrator" ) { $ config [ 'url' ] = route ( "sirgrimorum_modelo::store" , [ "modelo" => $ modelo ] ) ; if ( \ Lang :: has ( 'crudgenerator::' . $ modelo . '.labels.create' ) ) { $ config [ 'botones' ] = trans ( "crudgenerator::$modelo.labels.create" ) ; } else { $ config [ 'botones' ] = trans ( "crudgenerator::admin.layout.crear" ) ; } } if ( request ( ) -> has ( '_itemRelSel' ) ) { $ view = View :: make ( 'sirgrimorum::crudgen.templates.relationshipssel_simple' , [ 'config' => $ config , 'datoId' => $ itemsRelSelId , 'columna' => $ itemsRelSelCampo , 'tabla' => ( new $ config [ 'campos' ] [ $ itemsRelSelCampo ] [ 'modelo' ] ) -> getTable ( ) , 'datos' => $ config [ 'campos' ] [ $ itemsRelSelCampo ] , 'js_section' => $ js_section , 'css_section' => $ css_section , 'modelo' => $ modelo ] ) ; } else { $ view = View :: make ( 'sirgrimorum::crudgen.create' , [ 'config' => $ config , 'tieneHtml' => CrudGenerator :: hasTipo ( $ config , [ 'html' , 'article' ] ) , 'tieneDate' => CrudGenerator :: hasTipo ( $ config , [ 'date' , 'datetime' , 'time' ] ) , 'tieneSlider' => CrudGenerator :: hasTipo ( $ config , 'slider' ) , 'tieneSelect' => CrudGenerator :: hasTipo ( $ config , [ 'select' , 'relationship' , 'relationships' ] ) , 'tieneSearch' => CrudGenerator :: hasTipo ( $ config , [ 'relationshipssel' ] ) , 'tieneFile' => CrudGenerator :: hasTipo ( $ config , [ 'file' , 'files' ] ) , 'tieneJson' => CrudGenerator :: hasTipo ( $ config , [ 'json' ] ) , 'js_section' => $ js_section , 'css_section' => $ css_section , 'modelo' => $ modelo ] ) ; } return $ view -> render ( ) ; }
Generate create view for a model
@param array $config Configuration array
@param boolean $simple Optional True for a simple view (just the form)
@return string Create form in HTML
Generate create view for a model