Skip to content
This repository has been archived by the owner on Nov 1, 2019. It is now read-only.

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Poulter authored Sep 7, 2019
1 parent aa93087 commit a0049f5
Showing 1 changed file with 5 additions and 65 deletions.
70 changes: 5 additions & 65 deletions README.md
Original file line number Diff line number Diff line change
@@ -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 `<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

0 comments on commit a0049f5

Please sign in to comment.