Skip to content

Introduction

thomas-veen edited this page May 28, 2020 · 9 revisions

Larawhale cms is a Laravel package that provides the features of a content management system to any new or existing Laravel application.

Here is a quick example how an entry can be configured. The entry will be made available in the user interface when it is saved in the default resources/entries folder.

// resources/entries/post.php
return [
    'type' => 'post',
    'name' => 'Post',
    'view' => 'entries.post',
    'fields' => [
        [
            'key' => 'route',
            'type' => 'route',
            'config' => [
                'rules' => 'required',
                'label' => 'Url',
            ],
        ],
        [
            'key' => 'title',
            'type' => 'text',
            'config' => [
                'rules' => 'required|string|max:191',
                'label' => 'Title',
            ],
        ],
        [
            'key' => 'body',
            'type' => 'textarea',
            'config' => [
                'rules' => 'required|string|max:1000',
                'label' => 'Body',
            ],
        ],
    ],
];

More information can be found at the entries configuration and fields configutation documentation.

This configuration will result in the following form to be rendered in the user interface.

Rendered post entry form

The configured fields of this entry have now been made available in the configured resources/views/entries/post.blade.php file.

// resources/views/entries/post.blade.php
<h1>
    {{ $entry->title }}
</h1>

{!! $entry->body !!}