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.
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.
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
app/Providers/NovaServiceProvider.php:
public function cards()
{
return [
new \Falbar\NovaCardCache\CacheCard(),
];
}
php artisan vendor:publish --provider="Falbar\NovaCardCache\CardServiceProvider"
php artisan nova:publish
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).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:
canSee(Request $request) on the card to check a gate, and/orGate::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.
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: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.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.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.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.composer.json, read the controller before deploying, and be ready to fork if the maintainer abandons it (very likely given the signals).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::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.How can I help you explore Laravel packages today?