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 Card Cache Laravel Package

falbar/nova-card-cache

A Laravel Nova package that adds caching support for dashboard cards, helping reduce repeated queries and speed up card rendering in Nova admin panels. Lightweight, easy to integrate into existing Nova applications, and useful for keeping dashboard metrics responsive.

View on GitHub
Deep Wiki
Context7

Getting Started

The package is a Laravel Nova dashboard card that gives you a button to flush the application cache without SSH-ing into the box. It is a single-purpose, very small package (1 star, no dependents), so treat the source as the documentation.

  1. Install via Composer. The repository slug (akbsit/nova-card-cache) and the vendor name (falbar) don't match, so confirm the actual package name from the repo's composer.json before running:
    composer require falbar/nova-card-cache
    
  2. Register the card in app/Providers/NovaServiceProvider.php:
    public function cards()
    {
        return [
            new \Falbar\NovaCardCache\CacheCard(),
        ];
    }
    
  3. Publish assets if the card ships compiled JS separately:
    php artisan vendor:publish --provider="Falbar\NovaCardCache\CardServiceProvider"
    php artisan nova:publish
    
  4. First use case: open the Nova dashboard, click the "Clear cache" button, then verify with php artisan tinker or by checking storage/framework/cache that the flush actually ran.

Where to look first, in order:

  • src/ — the card class (CacheCard.php or similar) with component(), width(), and any canSee/canRun methods.
  • routes/ or src/Http/Controllers/ — the endpoint the button POSTs to; this is where Artisan::call('cache:clear') lives.
  • resources/js/ — the Vue component, to see which HTTP verb and URL it uses.
  • composer.json — required Nova version (Nova 3 vs 4 differ in asset publishing).

Implementation Patterns

Register per-dashboard, not globally, once you have multiple dashboards. Nova 4 lets you return cards from a Dashboard class; adding the cache card only to an "Ops" dashboard keeps a destructive action off the default dashboard where every admin lands.

Gate the action server-side. A card is visible to anyone who can view the dashboard. If only certain roles should clear cache, either:

  • override canSee(Request $request) on the card to check a gate, and/or
  • add a gate check in the route/controller the card calls (Gate::authorize('clear-cache')), because hiding the button does not protect the endpoint.

Compose with other maintenance cards. The common pattern is a row of small operational cards: clear cache, clear config, clear views, clear routes. If the package only clears the default cache store, either extend the controller or add sibling cards from other packages so operators have one place to look.

Extend the flush action. If you need optimize:clear or a targeted cache:clear --tags=..., the cleanest approach is to copy the package's controller into your app, register your own route in routes/nova.php or a service provider, and point a custom card at it. Given how little code the package contains, forking is often cheaper than fighting the extension points.

Trigger from CI or a command too. Since the work is Artisan::call('cache:clear'), keep a plain artisan command or scheduled job as the source of truth and let the card be a UI wrapper. That way the dashboard button isn't the only way to recover when someone needs to flush cache outside business hours.

Local/staging pattern. Add the card to the local and staging dashboards as part of onboarding so testers can reset without shell access; keep it off production, or gate it to super-admin only.

Gotchas and Tips

  • Package name mismatch. Repo is akbsit/nova-card-cache, vendor is falbar. Composer will fail if you guess; open the repo's composer.json first. Also verify the CardServiceProvider namespace — it may be Akbsit\... in the code while installed under falbar/....
  • Nova 3 vs Nova 4 asset handling. Nova 4 moved to nova:assets / nova:publish semantics. If the card's Vue component 404s, the compiled JS wasn't published for your Nova version; check resources/js in the repo and whether dist/js/card.js is committed.
  • Route authorization is the real risk. A cache-clear endpoint that's only protected by "you need to be logged into Nova" is still a footgun on a shared admin. Confirm the route lives behind nova middleware and add your own can: middleware or gate check.
  • cache:clear ≠ optimize:clear. It won't clear compiled views, cached routes, or cached config. If the card's button doesn't seem to fix the problem, you likely needed view:clear or config:clear — the card is doing exactly what it says.
  • Distributed setups. On multi-node deployments using the file cache driver, cache:clear only clears the node that served the request. Use Redis/Memcached as the cache store, or accept that the button is local-only.
  • Permissions. Artisan::call runs as the PHP-FPM user, not your deploy user. File-based cache directories owned by a different user will silently fail or throw a Permission denied that surfaces only in storage/logs/laravel.log. Test with the button, then tail the log.
  • No tests, no CI, single star. Treat the package as sample code. Pin the version in composer.json, read the controller before deploying, and be ready to fork if the maintainer abandons it (very likely given the signals).
  • Debugging a dead button. Check, in order: (1) card registered in cards(); (2) nova:publish run; (3) browser network tab for the POST and its response; (4) storage/logs/laravel.log for exceptions from Artisan::call; (5) route list via php artisan route:list | grep -i cache.
  • Log the action. Wrap or fork the controller to Log::info('cache cleared', ['user' => auth()->id()]). For a destructive admin action with no audit trail, that's the first thing you'll wish you had.
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.
3mdikram/worldmoneywords
snowsoft/config
itmosoft/laravel-subscriptions
larva/laravel-ai-qwen
diephp/sequences
users-au/socialite-provider
twidpay/twid-logger
mrnewport/laravel-plaid
mrnewport/laravel-repo
mrnewport/laravel-docsign
mrnewport/laravel-stow
mrnewport/laravel-flow
mrnewport/laravel-priceable
mrnewport/laravel-nestedterms
fredmeng/laravel-apidoc-generator
itstructure/laravel-multilingual-tools
pdustdar/elasticsearch
markupai/php-sdk
rlacerda83/lumem-microservice-shipment
uni-method/symfony-lib