LaravelPackages.net
Acme Inc.
Toggle sidebar
lednerb/nova-text-linked-field

Laravel Nova custom Text Field with a link to a resource or custom URL

96
0
v1.1.0
About lednerb/nova-text-linked-field

lednerb/nova-text-linked-field is a Laravel package for laravel nova custom text field with a link to a resource or custom url. It currently has 0 GitHub stars and 96 downloads on Packagist (latest version v1.1.0). Install it with composer require lednerb/nova-text-linked-field. Discover more Laravel packages by lednerb or browse all Laravel packages to compare alternatives.

Last updated

Nova TextLinked custom field

Packagist Version Packagist Downloads

This package is an enhanced version of the original nikans/text-linked field with additional features:

  • open links in new tabs / targets
  • trim functionality with nova tooltip support

NB: The field is compatible to the original one, if you plan to change to this package you only have to update the imports.


Nova custom Text Field with a link to a resource (or any URL) on index screen.

Nova links ID fields to a resource by default. The custom field is useful if you're using a text ID field or want to link a resource's title, as shown below.

Nova TextLinked Field Example

The field behaves just like the default text field on detail and form screens.

Installation

composer require lednerb/nova-text-linked-field

Usage options

use Lednerb\TextLinked\TextLinked;

...

TextLinked::make('Title', 'title')
    ->link($this),
    
TextLinked::make('ID')
    ->link($this),
TextLinked::make('Title', 'title')
    ->linkResource($this->uriKey(), $this->id),

Add a random URL

TextLinked::make('ID')
    ->url("https://novapackages.com"),
TextLinked::make('Title', 'title')
    ->link($this)
    ->openInNewTab(),

TextLinked::make('Title', 'title')
    ->link($this)
    ->openInNewTab('myTarget'), 

Trim long values to a specific amount of chars

Nova TextLinked Field Trim Functionality

TextLinked::make('Title', 'title')
    ->link($this)
    ->trim(), // Default are 50 chars

TextLinked::make('Title', 'title')
    ->link($this)
    ->trim(60), 

By default a tooltip will be shown on hover state with the full untrimed value. If you don't want the tooltip, you can disable it as follows:

TextLinked::make('Title', 'title')
    ->link($this)
    ->trim()
    ->hideTooltip(),

Star History Chart