Weave Code
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
Laravel Filament Action Preview

Laravel Filament Action Preview Laravel Package

novius/laravel-filament-action-preview

Add a Filament table action that opens a front-end preview URL for a resource record. Works with a model previewUrl() method or a custom URL callback via using(). Supports Laravel 11+ and Filament v4.

View on GitHub
Deep Wiki
Context7

This package allows you to add Filament action to open the front preview url of a ressource.

Frequently asked questions about Laravel Filament Action Preview
How do I add a preview action to a Filament resource table?
Use the `PreviewAction::make()` method in your resource’s `table()` method. If your model lacks a `previewUrl` method, define a custom URL resolver via the `using()` closure, like `PreviewAction::make()->using(fn($record) => route('posts.show', $record))`.
Does this package work with Filament v3+ only?
Yes, this package requires Filament v3+ (or v4+). If you’re on an older version, upgrade Filament first or check for a compatible fork. The README confirms Laravel 11/10 support, but Filament version compatibility is critical.
What if my frontend routes use dynamic slugs (e.g., `/posts/{slug}`) instead of IDs?
Override the `getPreviewUrl()` method in your resource class to return the correct route. For example, `return route('posts.show', ['slug' => $this->slug]);`. The package won’t auto-detect dynamic slugs, so custom logic is required.
Can I restrict preview access to specific roles or permissions?
Yes, use Filament’s built-in action modifiers like `visible()` or `requiresConfirmation()`. For role-based access, leverage Filament’s policy system or middleware. Example: `PreviewAction::make()->visible(fn($livewire) => $livewire->getUser()->can('preview-posts'))`.
Will previews trigger extra database queries or slow down Filament?
No, previews are purely frontend URL-based and don’t load additional data by default. However, if your frontend route resolves eager-loaded relationships, ensure your model uses `with()` or caching to avoid N+1 queries during previews.
How do I test preview actions in PHPUnit?
Mock the `PreviewAction` by stubbing the `getPreviewUrl()` method or using Laravel’s HTTP test helpers. For example, `PreviewAction::shouldReceive('getPreviewUrl')->andReturn(route('posts.show', 1));` in your test setup.
Does this package support multi-tenancy (e.g., Laravel Nova-like setups)?
Not out of the box. For multi-tenancy, override `getPreviewUrl()` to include tenant-aware routes or middleware. Example: `return route('tenants.posts.show', ['tenant' => auth()->tenant(), 'post' => $this])`.
What if my frontend isn’t Laravel-based (e.g., React/Node.js API)?
This package assumes Laravel frontend routes. For non-Laravel frontends, you’ll need to manually generate preview URLs (e.g., API endpoints) or use a different solution like browser extensions for manual previews.
How do I customize the preview button label or icon?
Use Filament’s action modifiers. For example, `PreviewAction::make()->label('Live Preview')->icon('eye')`. You can also publish and translate language files with `php artisan vendor:publish --tag=lang` for full customization.
Is there a risk of breaking changes if Filament v3 evolves post-release?
Yes, as this package targets Filament v3+, future Filament updates may introduce breaking changes. Monitor the [GitHub repo](https://github.com/novius/laravel-filament-action-preview) for compatibility notes or consider forking if major Filament updates occur.
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.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky