den1n/nova-pages

Laravel Nova static pages resource.

v2.2.1 2022-03-24 09:38 UTC

README

Static pages resource for Laravel Nova.

Installation

Install package with Composer.

composer require den1n/nova-pages

Publish package resources.

php artisan vendor:publish --provider="Den1n\NovaPages\ServiceProvider"

This will publish the following resources:

  • Configuration file config/nova-pages.php
  • Migration file database/migrations/*_create_pages_tables.php
  • Translations resources/lang/vendor/nova-pages

Migrate database.

php artisan migrate

Add instance of class Den1n\NovaPages\Tool to your App\Providers\NovaServiceProvider::tools() method to display the pages within your Nova resources.

/**
 * Get the tools that should be listed in the Nova sidebar.
 *
 * @return array
 */
public function tools()
{
    return [
        new \Den1n\NovaPages\Tool,
    ];
}

After that Pages resource will be available in navigation panel of Nova.

Page types

By default all pages will has default type.

You can register additional types in configuration file config/nova-pages.php.

/**
 * Page types.
 */

'types' => [
    // ...
    [
        'name' => 'my_type',
        'description' => 'My Type',
    ],
],

After that new type will be available to select when creating page or updating existing one.

WYSIWYG editor

By default package uses default WYSIWYG editor provided by Nova.

You can replace default editor. For example, with froala/nova-froala-field.

To do this, install the package and update editor settings in config/nova-pages.php file.

    /**
     * Settings for WYSIWYG editor.
     */

    'editor' => [
        /**
         * Nova field class name.
         */

        'class' => \Froala\NovaFroalaField\Froala::class,

        /**
         * Options which will be applied to te field instance.
         * Key: name of field method.
         * Value: list of method arguments.
         */

        'options' => [
            'withFiles' => ['public', 'nova-pages'],

            // Froala options.
            'options' => [[
                'heightMax' => 800,
                'heightMin' => 300,
            ]],
        ],
    ],

Screenshots

Pages

Pages

Page Form

Page Form

Page Details

Page Details

Contributing

  1. Fork it.
  2. Create your feature branch: git checkout -b my-new-feature.
  3. Commit your changes: git commit -am 'Add some feature'.
  4. Push to the branch: git push origin my-new-feature.
  5. Submit a pull request.

Support

If you require any support open an issue on this repository.

License

MIT