Skip to content

Collection global configuration

The configureOzuCollection() mainly allows defining:

  • the label and icon of the collection in the Dashboard sidebar
  • whether the collection has a publication state (draft/published)
  • whether new entries can be created and deleted
php
namespace App\Models;

class Project extends Model
{
    use IsOzuModel;

    public static function configureOzuCollection(OzuCollectionConfig $config): OzuCollectionConfig
    {
        return $config
            ->setLabel('Projects')
            ->setIcon('fa-ruler-combined')
            ->setHasPublicationState()
            ->setIsCreatable()
            ->setIsDeletable(false);
    }
    
    // ...
}

Available methods of OzuCollectionConfig

The configureOzuCollection() method receives an OzuCollectionConfig instance which allows you to define the general settings of the collection in the CMS.

setLabel(string $label)

Sets the display name of the collection in the CMS sidebar and headings.

setIcon(string $icon)

Sets the icon for the collection in the CMS sidebar. Ozu uses FontAwesome or Lucide icons from the blade-icon package (see https://blade-ui-kit.com/blade-icons, e.g., fas-user, lucide-book).

setHasPublicationState(bool $hasState = true)

Default: false
When enabled, Ozu will add a "published" toggle for each entry in the collection. This allows content managers to draft content before making it public. In practice, draft entries are not deployed to the static site.

setIsCreatable(bool $isCreatable = true)

Default: true
Defines if new entries can be created in this collection. Set to false for collections that should have a fixed set of entries.

setIsDeletable(bool $isDeletable = true)

Default: true
Defines if entries can be deleted from this collection.

overrideLabelAttributeInDashboard(string $attribute)

Default: title Overrides the default label attribute used in the dashboard (like in the Undeployed posts list, ...).

addSubCollection(string $collectionClass)

Allows nesting another Ozu model as a sub-collection. This is useful for organizing related content. See the dedicated documentation section [TODO].

setAutoDeployDateField(string $fieldKey)

Specifies a date field that will trigger an automatic deployment of the static site when the date is reached. This is useful for scheduled posts.

WARNING

This feature is currently in beta. Note that the field MUST be a date field,