novius / laravel-filament-action-preview
A Laravel Filament action for open front preview
Installs: 105
Dependents: 2
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/novius/laravel-filament-action-preview
Requires
- php: >=8.2
- filament/filament: ^4.0 | ^5.0
- laravel/framework: ^11.0 | ^12.0
Requires (Dev)
- larastan/larastan: ^3.1
- laravel/pint: ^1.10
- orchestra/testbench: ^10.3
- roave/security-advisories: dev-latest
README
Introduction
This package allows you to add Laravel Filament action to open the front preview url of a ressource.
Requirements
- Laravel Filament >= 4
- Laravel >= 11.0
- Laravel >= 8.2
Installation
You can install the package via composer:
composer require novius/laravel-filament-action-preview
Usage
This package provides the following action:
\Novius\LaravelFilamentActionPreview\Filament\Actions\PreviewAction
If the model have a previewUrl method :
use Filament\Resources\Resource; use Novius\LaravelFilamentActionPreview\Filament\Actions\PreviewAction; class Post extends Resource { public static function table(Table $table): Table { return $table ->actions([ PreviewAction::make(), ]); }
Otherwise, you must specify the preview url :
use App\Models\Post as PostModel; use Filament\Resources\Resource; use Novius\LaravelFilamentActionPreview\Filament\Actions\PreviewAction; class Post extends Resource { public static function table(Table $table): Table { return $table ->actions([ PreviewAction::make() ->using(function(PostModel $record) { return route('post.preview', ['post' => $record]); }), ]); }
Lang files
If you want to customize the lang files, you can publish them with:
php artisan vendor:publish --provider="Novius\LaravelFilamentActionPreview\LaravelFilamentActionPreviewServiceProvider" --tag="lang"
Lint
Lint your code with Laravel Pint using:
composer run-script lint
Licence
This package is under GNU Affero General Public License v3 or (at your option) any later version.