diff --git a/README.md b/README.md index 6e60773..0d09c83 100644 --- a/README.md +++ b/README.md @@ -1,72 +1,12 @@ # Laravel Nova Link Field -[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) - -#### Index View -![](github/index.png?raw=true) - -#### Edit View -![](github/edit.png?raw=true) +A Laravel Nova Link field. Modified version of khalin/nova-link-field. ## Installation -1. `composer require khalin/nova-link-field` - -## Usage - -1. Include the dependency `use Khalin\Nova\Fields\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}"; - }) -``` +To use this package, you need a Laravel installation with [Nova](https://nova.laravel.com). -### Set custom link text -For this needs you can use `text()` function (accept `Callable` or `text`) +**Composer** -Example: -``` -Link::make('Charge Id', 'stripe_id') - ->url(function () { - return "https://dashboard.stripe.com/payments/{$this->stripe_id}"; - }) - ->text("Go To Stripe") +```bash +composer require simplesquid/nova-link-field ``` - -#### 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 `` -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