Entry routing - larawhale/cms GitHub Wiki
Entries can be made available to visiters of your application. This can be done by adding a field with the configured cms.fields.route_field_type
field type. By default this is 'route'
but you are free to configure this to any type.
An example of an entry configuration with the 'route'
type could look like this:
// resources/entries/post.php
return [
'type' => 'post',
'name' => 'Post',
'view' => 'entries.post',
'fields' => [
[
'key' => 'route',
'type' => 'route',
],
// ... plus title and body fields ...
],
];
A field will now be rendered in the user interface where the users can fill in a path on which the entry should be made available to visitors.
As mentioned in the entry configuration, the view
property in the entry configuration can be used to point to a blade view that should be rendered when this type of entry is displayed in the browsers.
The above example will utilize the resources/views/entries/post.blade.php
file to render the content. This view will receive an Entry
instance on which all the configured fields are made available as properties.
// resources/views/entries/post.blade.php
<h1>
{{ $entry->title }}
</h1>
{!! $entry->body !!}
There is no limitation on how to write these blade files. Developer can write these files just how they are used to.