Model

Example of of result of the Model Component

The newRoot() function allows you to define a new chapter within your CMS. To use this, you'll need to pass a new model instance to the function. Models are created using the new keyword followed by a class name starting with \model\.

Adding a Menu Item for the Homepage

Suppose you want to add a menu item in the admin panel for the homepage. You can achieve this by initializing the model class as follows:

@php($home = newRoot(new \model\home));

Adding a Custom Label

If you want a different label to appear in the menu, use the ->label() method. For example:

@php($home = newRoot(new \model\home)->label('Homepage'));

Generating Input Fields

Once you've created a root model, you can generate input fields using the $header object. Here is an example of how to generate a text input field for a title:

@php(newRoot(new \model\home)->label('Homepage'))
<h1>{{ $header->text('title') }}</h1>

Summary

By combining Blade templates, Tailwind CSS, and the newRoot() function, you can efficiently build and style a flexible CMS. Use newRoot() to define chapters, customize labels for better navigation, and generate dynamic input fields for your admin interface.

No more than once a month
Newsletter