upline/nova-link-field is a Laravel package for a laravel nova field..
It currently has 1 GitHub stars and 27.339 downloads on Packagist (latest version 1.0.0).
Install it with composer require upline/nova-link-field.
Discover more Laravel packages by upline
or browse all Laravel packages to compare alternatives.
Last updated
composer require upline/nova-link-field
use Upline\NovaLinkField\Link;
class User extends Resource
{
// ...
public function fields(NovaRequest $request)
{
return [
// ...
Link::make('Instagram') // Get link from instagram model field
->text(fn() => 'Instagram link') // Set static anchor
->target('_blank') // Set target attribute
];
}
}
use Upline\NovaLinkField\Link;
class User extends Resource
{
// ...
public function fields(NovaRequest $request)
{
return [
// ...
Link::make('Instagram', fn($resource) => 'https://instagram.com/' . $resource->instagramId) // Compute link
->text('instagram_username') // Use instagram_username field as anchor text
->target('_blank')
];
}
}
In this example we don't escape $username, so we can get some security troubles.
Text::make('Twitter Profile', function () {
$username = $this->twitterUsername;
return "<a href='https://twitter.com/{$username}'>@{$username}</a>";
})->asHtml(),
Same, using this package:
Link::make('Twitter Profile', function () {
$username = $this->twitterUsername;
return "https://twitter.com/{$username}";
})->text('username'),
However, in this case link and username will be escaped. If you need to use html in anchor text, you still can use asHtml() method.