Skip to content

Custom your views

misterdebug edited this page Sep 26, 2022 · 1 revision

By default, all views extends a template called default.

And the content is in a section called content.

You can change it in the config file: config/crudgen.php.

2 config options are available:

views_style_directory

Is the directory name in resources/crudgen/views, you want to use. A default-theme directory is added when you publish vendor assets. You can duplicate/remove it and add multiple themes according your needs.

separate_style_according_to_actions

Each 4 views (index, create, edit, show) can have different @extends and @section options

config/crudgen.php:

[
    'views_style_directory'=> 'default-theme', // here change the default theme directory name
    'separate_style_according_to_actions'=>
    [
        'index'=>
        [
            'extends'=>'default',
            'section'=>'content'
        ],
        'create'=>
        [
            'extends'=>'default',
            'section'=>'content'
        ],
        'edit'=>
        [
            'extends'=>'default',
            'section'=>'content'
        ],
        'show'=>
        [
            'extends'=>'default',
            'section'=>'content'
        ],
    ],
    
];

When you publish vendor, you will have a directory named default-theme, you can duplicate this directory and modify the content with your needs.

You can have multiple designs at the same time but don't forget to change the views_style_directory value option before call command :)

image