Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Nova Simple Cms Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Getting Started

  1. Install and publish assets. 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
    
  2. Look first at three places (in this order):
    • The package's config file in config/ — as of v0.3.1 this is where the is_visible / published_at visibility toggles live.
    • The Nova field/Resource class the README tells you to register — that's where fluent modifiers (if any) are exposed.
    • resource_path('lang/vendor/nova') — the new translation home for this release.
  3. First use case: add the field to a Nova Resource and immediately validate the toggles work end-to-end:
    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.

Implementation Patterns

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.

Gotchas and Tips

  • Translation path collision (the big one). 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.
  • Custom 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.
  • Clearing caches after toggling. Config-driven visibility is cached: php artisan config:clear (or optimize:clear) after changing a toggle, or you'll debug a "stale" UI for ten minutes.
  • Hiding ≠ securing. A hidden is_visible field is still a fillable column. Keep $fillable/casts/policy checks in place; never treat the toggle as an access control.
  • Hidden fields can silently preserve stale values. If 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.
  • Re-publish translations cautiously. vendor:publish --force overwrites your translator's edits. Prefer adding a locale file rather than overwriting an existing one.
  • Debugging recipe. 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.
  • Extension points worth knowing now. Published views let you restyle the field without forking; the field class's 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/.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
coleus/frame
thtg88/journalism
filagora/filagora-ai-forums
rlacerda83/query-parser
socialdept/atp-orm
cboxdk/laravel-assistant-client
socialdept/atp-resolver
socialdept/tenant-domains
tautvydasr/blade-class-names
socialdept/color-scales
maherelgamil/controller
coleus/widgets
coleus/table
coleus/users
coleus/music
coleus/health
coleus/calendar
coleus/notes
coleus/support
coleus/settings