joonas1234/nova-simple-cms
A lightweight content management add-on for Laravel Nova, offering simple ready-made resources to manage site content directly from the Nova admin panel. Easy to install and configure, it suits small sites and projects needing basic CMS functionality without a heavy platform.
composer require <vendor>/<package> then publish config and translations:
php artisan vendor:publish --provider="Vendor\Package\PackageServiceProvider"
php artisan vendor:publish --tag=<package>-translations # confirm tag via `php artisan vendor:publish` list
config/ — as of v0.3.1 this is where the is_visible / published_at visibility toggles live.resource_path('lang/vendor/nova') — the new translation home for this release.public function fields(NovaRequest $request)
{
return [
ID::make()->sortable(),
// ... the package's field ...
\Vendor\Package\Field::make('Visibility'),
];
}
Confirm the form shows/hides is_visible and published_at, then flip each toggle in config and reload — that single loop exercises the whole v0.3.1 surface area.Config-level toggles (app-wide default). Publish the config once, drive visibility from there, and keep the decision out of individual resources:
// config/<package>.php
'show_is_visible' => env('NOVA_SHOW_IS_VISIBLE', true),
'show_published_at' => env('NOVA_SHOW_PUBLISHED_AT', true),
This is the pattern to use when only some environments/tenants care about the publishing pair (e.g. staging shows both, a trimmed-down CMS hides is_visible).
Per-field overrides (local exceptions). If the field exposes fluent setters, prefer them over new config keys so the intent lives next to the field:
Field::make('Visibility')
->hideIsVisible() // verify exact method on the field class
->hidePublishedAt();
Keep a single helper (VisibilityField::make()) in app/Nova/Fields/ that applies your house defaults, so a future release renaming a method is a one-file fix.
Fall back to native Nova when the toggles don't cover the case. Conditional, per-request, or per-user visibility is still Nova's job:
Field::make('Visibility')
->canSee(fn (NovaRequest $request) => $request->user()->isAdmin())
->hideWhenCreating()
->onlyOnForms();
Don't invent a config flag for something a closure handles better — the package toggles look intended for structural on/off, not authorization.
Index vs. form split. published_at is usually useful in the index (sortable/filterable) but is_visible is only meaningful in forms. Wire that explicitly rather than relying on the defaults:
Field::make('Visibility')->onlyOnForms(),
Date::make('Published At')->sortable()->filterable(),
Localization workflow (v0.3.1). The package now reads JSON translations from resource_path('lang/vendor/nova'). Treat that directory as package-owned-but-overridable:
# after publishing, edit keys in place
resource_path('lang/vendor/nova/de.json')
// in tests, prove the key resolves
app()->setLocale('de');
$this->assertSame('Sichtbar', __('is_visible'));
Add a smoke test asserting Lang::has() for each locale you ship — that catches a missing/garbled JSON file before a translator does.
lang/vendor/nova is Nova's own vendor namespace. A package writing JSON translations there can be overwritten by a Nova upgrade (composer update laravel/nova), by php artisan lang:publish, or by your deploy's directory sync. Back up or version-control any file you edit in that directory, and re-check it after every Nova bump.lang_path() breaks the new behaviour. If you've called App::useLangPath() (Laravel 9+) or relocated the lang directory, a hard-coded resource_path('lang/vendor/nova') won't follow it. Verify with php artisan tinker → app()->langPath() against what the provider registers.php artisan config:clear (or optimize:clear) after changing a toggle, or you'll debug a "stale" UI for ten minutes.is_visible field is still a fillable column. Keep $fillable/casts/policy checks in place; never treat the toggle as an access control.published_at is hidden on update, users can't clear a previously set date. Decide deliberately whether the hidden state means "not editable" or "not visible but editable", and test the update path, not just the form render.vendor:publish --force overwrites your translator's edits. Prefer adding a locale file rather than overwriting an existing one.config('<package>.show_published_at') for the toggle, Lang::has('is_visible') and __('is_visible') for the string, and php artisan nova:field <vendor>/<package> / composer show <vendor>/<package> to confirm you're actually on 0.3.1 before blaming the code.resolve/fill are the place to hook in if you need published_at to auto-set on first publish. Both are cheaper than patching vendor/.How can I help you explore Laravel packages today?