Skip to content

What's New? โ€‹

Changes in the Latest Version โ€‹

  • (#79) โš™๏ธ Laravel 12 Support, now compatible with Laravel 12.

  • (#59) ๐Ÿ”’ Fixed issue with password input rendering in forms.

  • (#60) โœ๏ธ Corrected grammar and sentence structure.

  • (#62) ๐Ÿงฉ Fixed unhandled match case for value '0'.

  • (#85) โž• Fixed inability to create new submenu items.

  • (#71) ๐Ÿ“ Fixed typo: "telepon" โ†’ "telephone".

  • (#57) ๐Ÿงผ Replaced str_replace() with a custom, more robust function.

  • (#64) ๐Ÿ“ฆ Made Intervention/Image an optional dependency.

  • ๐Ÿ†• Introduced new ImageServiceV2() class for better image handling.

  • ๐Ÿงน Refactored ViewServiceProvider for cleaner structure.

  • โš™๏ธ Added new generator.image config for image settings.

  • ๐Ÿ“ธ Change default image configuration from placeholder.com to placehold.co.

For the most recent and complete changelog, please visit Github Releases

How to Update โ€‹

  1. Update Generator

    sh
    composer require evdigiina/generator:^0.4.0 --dev
  2. Publish new ImageService class.

    sh
    php artisan generator:publish-image-service-v2
  3. Install latest version of Intervention Image.

    sh
    composer require intervention/image-laravel
  4. In App\Providers\ViewComposerServiceProvider.php import ViewContract

    php
    use Illuminate\Contracts\View\View as ViewContract;
  5. Changes in generator.image config.

For additional information on these changes, go here.

New Features ๐Ÿ”ฅ โ€‹

New features added in Generator v0.4.x:

  • โš™๏ธ Laravel 12 Support
    Now compatible with Laravel 12.

  • ๐Ÿงพ Export to Excel (Beta)
    Added support for exporting data to Excel.

  • ๐Ÿท๏ธ Named Parameters in Generated Code
    Improves readability and maintainability of generated code.

  • ๐ŸŽจ Color Input Rendering
    Displays color preview in index and show pages if input type is color.

  • โœ… Boolean Icon Rendering
    Automatically adds icon for boolean fields in index and show pages.

  • ๐Ÿ” Role & User Resource APIs
    Adds RESTful API resources for managing roles and users.

  • ๐Ÿ–ผ๏ธ Image Casting on Model
    Adds native support for handling images using custom model casts.

  • ๐Ÿฉน Update option in the configuration generator.image.disk, previously known as public, storage, s3, you can now select public, local,public_path or s3.

    Here's an example.

php
 /**
  * If any input file(image) as default will use options below.
  */
  'image' => [ 
    /**
     * Path for store the image.
     *
     * Available options:
     * 1. public or storage.public
     * 2. local or storage.local
     * 3. public_path
     * 4. S3
     */
    'disk' => 'public', 

    // other configuration codes.
]

If you want to see the default latest configuration, it is below:

php
return [
    /**
     * If any input file(image) as default will use options below.
     */
    'image' => [ 
        /**
         * Path for store the image.
         *
         * Available options:
         * 1. public or storage.public
         * 2. local or storage.local
         * 3. public_path
         * 4. S3
         */
        'disk' => 'public', 

        /**
         * Will be used if image is nullable and default value is null.
         */
        'default' => 'https://placehold.co/300?text=No+Image+Available', 

        /**
         * Crop the uploaded image using intervention image.
         */
        'crop' => true, 

        /**
         * When set to true the uploaded image aspect ratio will still original.
         */
        'aspect_ratio' => true, 

        /**
         * Crop image size.
         */
        'width' => 300, 
        'height' => 300, 
    ],

    'format' => [ 
        /**
         * Will be used to first year on select, if any column type year.
         */
        'first_year' => 1970, 

        /**
         * If any date column type will cast and display used this format, but for input date still will used Y-m-d format.
         *
         * another most common format:
         * - M d Y
         * - d F Y
         * - Y m d
         */
        'date' => 'Y-m-d', 

        /**
         * If any input type month will cast and display used this format.
         */
        'month' => 'Y/m', 

        /**
         * If any input type time will cast and display used this format.
         */
        'time' => 'H:i', 

        /**
         * If any datetime column type or datetime-local on input, will cast and display used this format.
         */
        'datetime' => 'Y-m-d H:i:s', 

        /**
         * Limit string on index view for any column type text or long text.
         */
        'limit_text' => 100, 
    ],

    /**
     * It will be used for generator to manage and showing menus on sidebar views.
     *
     * Example:
     * [
     *   'header' => 'Main',
     *
     *   // All permissions in menus[] and submenus[]
     *   'permissions' => ['test view'],
     *
     *   menus' => [
     *       [
     *          'title' => 'Main Data',
     *          'icon' => '<i class="bi bi-collection-fill"></i>',
     *          'route' => null,
     *
     *          // permission always null when isset submenus
     *          'permission' => null,
     *
     *          // All permissions on submenus[] and will empty[] when submenus equals to []
     *          'permissions' => ['test view'],
     *
     *          'submenus' => [
     *                 [
     *                     'title' => 'Tests',
     *                     'route' => '/tests',
     *                     'permission' => 'test view'
     *                  ]
     *               ],
     *           ],
     *       ],
     *  ],
     *
     * This code below always changes when you use a generator, and maybe you must format the code.
     */
    'sidebars' => [ 
        [ 
            'header' => 'Main', 
            'permissions' => ['test view'], 
            'menus' => [ 
                [ 
                    'title' => 'Main Data', 
                    'icon' => '<i class="bi bi-collection-fill"></i>', 
                    'route' => null, 
                    'permission' => null, 
                    'permissions' => ['test view'], 
                    'submenus' => [ 
                        [ 
                            'title' => 'Tests', 
                            'route' => '/tests', 
                            'permission' => 'test view', 
                        ], 
                    ], 
                ], 
            ], 
        ], 
        [ 
            'header' => 'Users', 
            'permissions' => ['user view', 'role & permission view'], 
            'menus' => [ 
                [
                    'title' => 'Users', 
                    'icon' => '<i class="bi bi-people-fill"></i>', 
                    'route' => '/users', 
                    'permission' => 'user view', 
                    'permissions' => [], 
                    'submenus' => [], 
                ], 
                [ 
                    'title' => 'Roles & permissions', 
                    'icon' => '<i class="bi bi-person-check-fill"></i>', 
                    'route' => '/roles', 
                    'permission' => 'role & permission view', 
                    'permissions' => [], 
                    'submenus' => [], 
                ], 
            ], 
        ], 
    ], 
];