Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Url Button In Forms Laravel Package

seoegypt/url-button-in-forms

Adds a configurable URL button to Laravel forms so users can open external links in a new tab without leaving the form. Handy for help docs, terms, or reference pages, and easy to drop into existing form schemas.

View on GitHub
Deep Wiki
Context7

Getting Started

Install

composer require seoegypt/url-button-in-forms

If the package ships frontend assets, Nova auto-registers them via its service provider. Run php artisan nova:publish afterward so the compiled JS lands in public/vendor/url-button-in-forms (or wherever nova-assets points).

Where to look first

  1. README.md for the exact field/component class name and available methods.
  2. src/ for the ServiceProvider (asset registration) and the Field class — confirm the namespace and whether it extends Laravel\Nova\Fields\Field or is a custom NovaElement.
  3. resources/js/ for the Vue component; this tells you which meta keys (url, target, text) the button actually reads.
  4. composer.json for the supported Nova/Laravel constraints — this is the single most important compatibility signal for a package this small.

First use case

Drop a link button into a resource form so editors can jump to related documentation or an external tool without leaving the create/update screen:

use SeoEgypt\UrlButtonInForms\UrlButtonInForms;

public function fields(Request $request)
{
    return [
        // ... normal fields
        UrlButtonInForms::make('Open Docs')
            ->url('https://docs.example.com')
            ->target('_blank'),
    ];
}

This is the package's sweet spot: a display-only element in fields() that renders a link, not a persisted column.

Implementation Patterns

Static link button in a form

The simplest pattern — a fixed URL for help, changelog, or an internal admin tool. Place it last in fields() so it sits at the bottom of the form panel.

Dynamic URL via closure

Most packages of this shape accept a closure, evaluated per-request:

UrlButtonInForms::make('View Invoice')
    ->url(fn () => $this->resource->invoice_url ?? '#')
    ->canSee(fn () => $this->resource?->invoice_url !== null),

This is the pattern that actually earns the dependency — otherwise you'd hardcode a link in a custom field.

Scoping to the right views

Because the field has no underlying model column, gate it explicitly:

UrlButtonInForms::make('Open in CRM')
    ->onlyOnForms()
    ->hideWhenCreating()
    ->canSee(fn () => $this->resource->crm_id !== null)

onlyOnForms() prevents it from appearing on index/detail tables where a button column makes no sense.

Grouping and layout

Treat it like any Nova field for placement — ->panel() to dock it in a side panel, ->sortable()-style positioning (or ->withMeta(['sortable' => false]) if the field doesn't default to non-sortable) to control order. For an action-oriented button, a dedicated panel next to a "Status" panel reads better than burying it between text inputs.

Companion to Actions

A useful workflow is pairing the button with a Nova Action: the button links to the external record, an action triggers a sync. Both live on the same detail view, with the button as the read path and the action as the write path.

In related-resource and pivot forms

Place it after the relationship fields in UpdateAttachedRequest-style forms if the package supports arbitrary placement — most Nova fields do. Verify in the browser that the component mounts; pivot forms use a different Vue tree and some custom components silently fail there.

Gotchas and Tips

Nova version drift is the real risk. Last release was 2023-09-11, which likely targets Nova 4 (Vue 2). Nova 5 moved to Vue 3 and changed asset/build conventions. Check composer.json's laravel/nova constraint before installing; if it caps at ^4.0, expect the Vue component to fail to render on Nova 5 with a blank space or a console error about unknown tags.

Compiled assets may be absent. Tiny packages often ship source without dist/. If the button doesn't appear, check nova-components / public/vendor and look for a webpack.mix.js or vite.config.js in the vendor folder — you may need to npm install && npm run prod inside vendor/seoegypt/url-button-in-forms.

Display-only fields still get validated. Don't attach ->rules('required') or ->rules('url') to it — it has no request payload, so validation will fail on every submit. If you need URL validation, do it on the source attribute, not the button.

Not persisted, not searchable. Don't add it to $search or assume it appears in the indexQuery. If it leaks into an index view, table rendering will try to sort/filter on a nonexistent column and either 500 or silently ignore it.

User-controlled URLs = open redirect. If ->url() reads from a model attribute set by users, validate with filter_var($url, FILTER_VALIDATE_URL) and, when opening in a new tab, ensure a sane target plus rel="noopener noreferrer". The button is a trivial phishing vector otherwise.

Debugging a blank button: open browser devtools, check the Nova asset manifest (public/vendor/nova/…), and confirm the component name inside resources/js/field.js matches what the PHP class sets via ->component(). A mismatched component string is the #1 cause of "field renders nothing."

Pin the version. With two stars and zero dependents, treat this as vendored code: composer require seoegypt/url-button-in-forms:1.x with an explicit constraint, and consider forking into app/Nova/Fields if you need to touch the Vue component. A five-line custom field doing the same job is a legitimate alternative if you need Nova 5 support — the package's value is convenience, not capability.

Extension points: publish the views/JS if the service provider offers --tag publish groups; override the Vue component in resources/js/ of your own app via Nova's asset pipeline; otherwise subclass the field and override component() or jsonSerialize() to inject extra meta like label, icon, or confirm if the component supports them.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
payerurl/telegrambot-crypto-payment-instant-payout
dskripchenko/laravel-hybrid-search
riorizkyrainey/lara-ced
mehedimi/static-vel
zharp/zharp
nonsapiens/bigquery-model-sync
lgu-bayambang-ict-office/lgu-laravel-development-standards
andydefer/laravel-support
se7enxweb/flysystem
lampwick/laravel
jeslage/statamic-emojis
micahdshackelford/rmap-laravel
draftsmaninc/draftsman
square-bit/laravel-volition
himito/laravel-mailman
htinlynn/genius-helper
maco-studios/hephaestus
elmogy/larafast
xeviant/laravel-paystack
gorilladash/laravel-website-sdk