Enabling the editor
config/admin.php
'frontend_editor' => true works as well. Run php artisan admin:migrate. It creates the table of the static content, which stores the edited images and links.
Add the @gettext directive to your layout. It loads the editor for administrators with access:
resources/views/layouts/app.blade.php
What can be edited
Images and files
- On the first render, the default asset is copied into the uploads and compressed. When the default asset changes, the copy is replaced.
- Without the editor,
asset()of the default is returned, without resizing. @uploadable(...)is the Blade form of the helper.- Uploaded files other than images are validated by
storage.allowed_extensions.
Links
Editor fields
editor and longeditor fields of a model are wrapped in an editable element on the website. Administrators with the update permission of the model edit them in place. Localized fields save the value of the current language.
Permissions
Saving requires a verified login. When two-factor verification is enabled, the administrator has to complete it first.
Separate frontend
For a frontend on another domain, e.g. Nuxt, enable the stateless mode and set the url of the frontend:config/admin.php
.env
personal_access_tokens table. Run php artisan migrate; without it the editor link ends in
an error instead of opening the website.
The Editor mode dropdown of the administration then offers Webový editor, which opens
{WEB_URL}/?admin_token=… in a new tab.
On a Nuxt frontend, do not write this by hand. The @crudadmin/helpers layer ships the whole
handshake as the auto-imported installEditor(); call it once when the app mounts:
app/app.vue
admin_token from the url, stores it in localStorage (ca_admin_token) and strips
the query string, so the editor survives navigation and reloads. Then it calls
GET /admin/api/frontend-editor/initialize with Authorization: Bearer {admin_token}, puts the
answer into window.CAEditorConfig and injects the returned scripts and styles.
The layer has to be extended for the composable to be available:
nuxt.config.ts
api/, so config/cors.php has to let the frontend origin reach
admin/* and vendor/*.
A frontend built with something else repeats the same handshake on its own. The token is valid
only for the frontend editor, not for the administration or the REST API. The edit mode is
stored in the browser.