khalin/nova-link-field

A Laravel Nova Link field.
598,460 31
Install
composer require khalin/nova-link-field
Latest Version:v1.2.4
PHP:>=8.0
License:MIT
Last Updated:Feb 16, 2023
Links: GitHub  ·  Packagist
Maintainer: oleghalin

Laravel Nova Link Field

License: MIT

Index View

Edit View

Installation

  1. composer require khalin/nova-link-field

Usage

  1. Include the dependency use Khalin\Nova\Field\Link;
  2. Add to the Fields array
Link::make('Charge Id', 'stripe_id'),

Advanced usage

Edit link href:

For this needs you can use url() function (accept Callable or string)

Example:

Link::make('Charge Id', 'stripe_id')
                ->url(function () {
                    return "https://dashboard.stripe.com/payments/{$this->stripe_id}";
                })

Set custom link text

For this needs you can use text() function (accept Callable or text)

Example:

Link::make('Charge Id', 'stripe_id')
                ->url(function () {
                    return "https://dashboard.stripe.com/payments/{$this->stripe_id}";
                })
                ->text("Go To Stripe")

Show icon instead of text

Replaces text with an icon on the index view. For this needs you can use icon() function

Example:

Link::make('Charge Id', 'stripe_id')
                ->url(function () {
                    return "https://dashboard.stripe.com/payments/{$this->stripe_id}";
                })
                ->text("Go To Stripe")
                ->icon()

Open link in blank window

For this needs you can use blank() function.

Example:

Link::make('Charge Id', 'stripe_id')
                ->url(function () {
                    return "https://dashboard.stripe.com/payments/{$this->stripe_id}";
                })
                ->blank()

Add additional classes to <a>

For this needs you can use classes() function (accept Callable or text).

Example:

Link::make('Charge Id', 'stripe_id')
                ->classes(function () {
                    return null === $this->charge_id ? 'charge__pending' : "charge_successfull";
                })

TODO

  • Cover field with tests

Related Packages

maatwebsite/laravel-nova-excel

Supercharged Excel exports for Laravel Nova Resources

6,858,728 403
vyuldashev/nova-permission

A Laravel Nova tool for Spatie's Permission library.

2,621,375 430
unm/laravel4-opencloud

A laravel 4.1 service provider package that wraps the Rackspace/Openstack PHP SD...

4 7
spatie/nova-backup-tool

A Laravel Nova tool to backup your application.

590,379 361
spatie/nova-tail-tool

A Laravel Nova tool to display the application log.

129,391 119