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.
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:
| Column | Type | Description |
|---|---|---|
title | text | |
content | text | |
slug | string | Auto-filled from the title |
order | integer | Used for ordering collections |
cover | Media | Relation 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.
configureOzuCollection: Define the collection's label, icon, and permissions (see Collection Configuration)configureOzuCollectionList: Define the columns to display in the list view (see Collection List Configuration)configureOzuCollectionForm: Define the fields to display in the form view (see Collection Form Configuration)
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:
use Code16\OzuClient\OzuCms\Form\OzuField;
return [
'collections' => [
\App\Models\Project::class,
],
// [...]
];Link your project to Ozu
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:
OZU_API_KEY=1|ABcdEFG1HiJ23KlmnO4pqRSTuv5W67Y8zaB9BCdE012efg34
OZU_WEBSITE_KEY=your-website-key
OZU_API_VERSION=v1| Variable | Description |
|---|---|
OZU_API_KEY | Your personal API token, generated in your Ozu profile. |
OZU_WEBSITE_KEY | The unique identifier for your website, found in the website settings in Ozu. |
OZU_API_VERSION | The API version (do not change this) |
Sync with Ozu
Finally, synchronize your project configuration with Ozu to update the CMS interface:
php artisan ozu:configureTIP
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.