think.studio / nova-html-field
HTML Laravel Nova field. (alternative of text field)
Installs: 1 921
Dependents: 3
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 2
Open Issues: 1
Requires
- php: ^8.1
- laravel/framework: ^9.0|^10.0
- laravel/nova: ^4.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.20
- orchestra/testbench: ^8.5
- phpunit/phpunit: ^10.2
- psalm/plugin-laravel: ^2.8
- vimeo/psalm: ^5.13
README
Usage Warning!
If you want use html only on Index (Preview) or Details screen, then please use default laravel nova functionality:
\Laravel\Nova\Fields\Text::make('Preview', function () { return view('custom-link', [ 'url' => url('/preview'), 'id' => $this->id, ])->render(); })->asHtml();
The package was created to add such a feature also to the Update and Create screens. (By default, Create screen is disabled.)
Installation
You can install the package via composer:
composer require think.studio/nova-html-field
Usage
Html::make('Preview', function () { return view('nova-html-field::blocks.link', [ 'href' => url('/preview'), 'linkText' => 'Preview', 'target' => '_blank', ])->render(); })->clickable(); Html::make('Preview', function () { return view('nova-html-field::blocks.links', [ 'links' => [ [ 'href' => url('/preview'), 'title' => 'title', 'target' => '_blank', ], [ 'href' => url('/preview'), 'title' => 'title', 'target' => '_blank', ], ] ])->render(); }) ->clickable() ->showOnIndex() ->showOnPreview(),
Html::make('Docs', fn() => view('nova-html-field::blocks.link', [ 'href' => $this->resource->pdfUrl(), ])->render() ) ->showOnCreating() ->clickable() ->help('Link to documentation');