This repository has been archived by the owner on Nov 1, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Matthew Poulter
authored
Sep 7, 2019
1 parent
aa93087
commit a0049f5
Showing
1 changed file
with
5 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |