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

Commit

Permalink
Initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
mdpoulter committed Sep 7, 2019
0 parents commit aa93087
Show file tree
Hide file tree
Showing 16 changed files with 11,389 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/.idea
/vendor
/node_modules
package-lock.json
composer.phar
composer.lock
phpunit.xml
.phpunit.result.cache
.DS_Store
Thumbs.db
72 changes: 72 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# 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)

## 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}";
})
```

### 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")
```

#### 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
39 changes: 39 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"name": "simplesquid/nova-link-field",
"version": "0.0.4",
"license": "MIT",
"description": "A Laravel Nova Link field. Fork of khalin/nova-link-field.",
"keywords": [
"laravel",
"nova",
"field",
"link"
],
"authors": [
{
"name": "Matthew Poulter",
"email": "[email protected]",
"role": "Developer"
}
],
"require": {
"php": ">=7.1.0"
},
"autoload": {
"psr-4": {
"SimpleSquid\\Nova\\Fields\\Link\\": "src/"
}
},
"extra": {
"laravel": {
"providers": [
"SimpleSquid\\Nova\\Fields\\Link\\FieldServiceProvider"
]
}
},
"config": {
"sort-packages": true
},
"minimum-stability": "dev",
"prefer-stable": true
}
8 changes: 8 additions & 0 deletions dist/css/field.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*!
* Copyright (c) 2019 Matthew Poulter. All rights reserved.
*/

.table td span.link-field {
display: block;
}

Loading

0 comments on commit aa93087

Please sign in to comment.