- What is khalin/nova-link-field used for?
- It is a Laravel Nova field that renders a URL column as a clickable link in Nova resource index and detail views. You add it to a resource's fields() method like any other Nova field. It is intended for admin-supplied links such as supplier portals, documentation pages, or campaign URLs. It does not change the underlying data model; URLs remain ordinary string columns.
- How do I install khalin/nova-link-field?
- Install it with Composer using composer require khalin/nova-link-field. There is no service provider, config file, migration, or publish step to run. The field and its compiled Vue component are loaded through Nova's asset pipeline. On modern Nova versions the install may be blocked by Composer platform requirements.
- How do I add the Link field to a Nova resource?
- Add Link::make('Website') or similar to the resource's fields() method. The field renders the value of the corresponding model column as a link in index and detail views. You can configure link text and target behavior through the field's API. Keep the raw URL in a normal string column so filters, exports, and APIs still work.
- Does khalin/nova-link-field support Laravel Nova 4 or Nova 5?
- No, it is not expected to work on Nova 4 or 5. The last tagged release is from May 2020, targeting the Nova 2.x/3.x, Laravel 6/7, and PHP 7.2-7.4 era. Nova 4 moved to Vue 3 and changed field asset registration, and this package has no service provider to call Nova::script(). Forcing installation with --ignore-platform-reqs risks a blank field or JavaScript errors on the resource page.
- Which Laravel, Nova, and PHP versions does this package support?
- The package dates from the Nova 2.x/3.x, Laravel 6/7, and PHP 7.2-7.4 era. Those are the versions where it is most plausible to install and work as advertised. On current Nova 4/5 and modern Laravel/PHP, expect Composer to block the install. Verify the exact constraints in the package's composer.json before attempting adoption.
- Can I set custom link text and open links in a new tab?
- Yes, the field supports configurable link text and target behavior, so you can label the link and use target="_blank". If you use target="_blank", you should ensure the rendered anchor includes rel="noopener noreferrer"; this policy is not documented by the package, so verify it in the compiled component or override the rendering. Treat any admin-supplied URL as untrusted and validate it.
- Does the Link field work in index, detail, and form views?
- It is documented for index and detail views, where it renders URLs as clickable links. Form behavior is undocumented and should be treated cautiously: a display-only field on a form can submit an empty value and silently blank the column on save. The safe pattern is to show Link on index and detail only and keep an editable Text or URL field on forms with hideFromIndex() and hideFromDetail().
- Is it safe to render admin-supplied URLs with this field?
- The package does not document URL scheme validation or rel attribute policy. A field that renders admin-supplied URLs should reject javascript: and data: schemes and should emit rel="noopener noreferrer" when target="_blank". Because neither behavior is documented, validate and normalize URLs yourself, for example with resolveUsing, before relying on the field in production.
- Can I normalize or modify the URL before it is displayed?
- Yes, you can push normalization into resolveUsing so the raw column stays clean. That is useful for adding https://, wrapping values in mailto:, or rejecting unsafe schemes. The field renders whatever the column resolves to, so the underlying data model is untouched. This keeps URLs available to filters, exports, and API consumers.
- Should I use this package or build my own Nova link field?
- For a team on modern Nova, building an in-house field is usually the better trade. A Link field extending Laravel\Nova\Fields\Field with a displayUsing callback and a small Vue component is hours of work and carries no version risk. This package offers a head start measured in an afternoon but is effectively unmaintained since 2020. On Nova 4/5 it is most useful as a reference implementation rather than a dependency.