Skip to content

Configure Your Project

Configure your Models as Ozu Collections

The models you want to manage through Ozu (that is, the ones for which you want to enable content management in the Ozu dashboard), referred to as “collections”, must follow a few specific rules:

Adapt you migration to Ozu

Your migration should use the Code16\OzuClient\Support\Database\MigratesOzuTable trait and call $this->createOzuTable('table_name'); in the up() method.

This will create the table with the base columns required by Ozu (see below). You can then add your custom columns as usual.

php
use Code16\OzuClient\Support\Database\MigratesOzuTable;
// ...

return new class extends Migration
{
    use MigratesOzuTable;

    public function up(): void
    {
        $this->createOzuTable('projects');

        Schema::table('projects', function (Blueprint $table) {
            $table->string('country')->nullable();
            // ...
        });
    }
};

Every Ozu model includes the following attributes:

ColumnTypeDescription
titletext
contenttext
slugstringAuto-filled from the title
orderintegerUsed for ordering collections
coverMediaRelation to a Media model for handling files and images

Configure your Model

Next, your model must use the Code16\OzuClient\Eloquent\IsOzuModel trait and define three static configuration methods, which allow you to precisely control how the collection is displayed and managed in the Ozu dashboard.

Update the configuration file

Once your models are ready, you must register them in the config/ozu-client.php configuration file. This is also where you define global website settings:

php
use Code16\OzuClient\OzuCms\Form\OzuField;

return [
    'collections' => [
        \App\Models\Project::class,
    ],

   // [...]
];

Get your API credentials

Next you'll need an Ozu account, attach to a dedicated project on the Ozu dashboard.

INFO

Currently, Ozu is in private beta, and we are actively looking for beta testers! If you want to test Ozu and provide feedback, please join the beta program 🚀

After creating your account and a website in the dashboard (learn more about this step here), you should have an API token and a website key: add them to your .env file:

dotenv
OZU_API_KEY=1|ABcdEFG1HiJ23KlmnO4pqRSTuv5W67Y8zaB9BCdE012efg34
OZU_WEBSITE_KEY=your-website-key
OZU_API_VERSION=v1
VariableDescription
OZU_API_KEYYour personal API token, generated in your Ozu profile.
OZU_WEBSITE_KEYThe unique identifier for your website, found in the website settings in Ozu.
OZU_API_VERSIONThe API version (do not change this)

Sync with Ozu

Finally, synchronize your project configuration with Ozu to update the CMS interface:

bash
php artisan ozu:configure

TIP

This command sends your project configuration to Ozu and should be run regularly to keep the Ozu dashboard in sync with your project. More specifically, you should run it after each model configuration update. It does not affect the production data managed in the CMS.