Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pdewit/nova-external-url
An external URL Laravel Nova field.
https://github.com/pdewit/nova-external-url
Last synced: 3 months ago
JSON representation
An external URL Laravel Nova field.
- Host: GitHub
- URL: https://github.com/pdewit/nova-external-url
- Owner: pdewit
- Created: 2018-08-23T13:12:01.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2022-02-08T11:34:39.000Z (almost 3 years ago)
- Last Synced: 2024-07-11T22:14:56.175Z (4 months ago)
- Language: Vue
- Size: 27.3 KB
- Stars: 31
- Watchers: 2
- Forks: 6
- Open Issues: 5
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Nova External URL Field
Adds the ability to show external URLs in the detail and index views of resources. It uses the resolving feature from Nova to generate links.
It will show up in the detail view like this:
And in the index view like this:
## Installation and usage
You can require this package using composer:
```
composer require pdewit/nova-external-url
```You can add the field with a resolver as follows:
```php
use Pdewit\ExternalUrl\ExternalUrl;ExternalUrl::make('Google Link', function () {
return 'https://www.google.com/search?q=' . $this->name;
}),
```## Customising the displayed text
You can customise the displayed text using the `linkText` function like so:
```php
use Pdewit\ExternalUrl\ExternalUrl;ExternalUrl::make('Google Link', function () {
return 'https://www.google.com/search?q=' . $this->name;
})->linkText($this->name),
```The label below the link normally shows the URL, but it can be overridden:
```php
use Pdewit\ExternalUrl\ExternalUrl;ExternalUrl::make('Google Link', function () {
return 'https://www.google.com/search?q=' . $this->name;
})->labelText('View search results on Google'),
```