kodmial/laravel-digital-business-cards
A Laravel package for creating, managing, and sharing digital business cards. It provides models, migrations, and configurable card profiles so you can publish contact details, links, and branding directly from your Laravel app.
The package builds on Filament: a business card is a standard Eloquent model edited through a Filament resource, with a shared form schema driving both the create and edit screens. Install and wire it up the same way as any Filament plugin:
composer require the package and run php artisan vendor:publish --tag="<package>-migrations" (plus the config tag if you need to change defaults), then php artisan migrate.->plugin(BusinessCardPlugin::make())) or, if it ships a resource only, point your panel at BusinessCardResource./admin/business-cards/create — and confirm the form renders before touching any config.Look first at the resource's form() definition and the CreateBusinessCard / EditBusinessCard page classes: in v1.4.0 these are unified, so the field list lives in one place and both pages consume it. That single schema is the extension point you'll spend most of your time in.
The first use case to exercise is the new preview: fill in the form (name, title, company, avatar, links), click Preview, and verify the modal renders the card from live form state without a record being written. That confirms two things at once — your form schema is valid and your card Blade partial renders outside the persisted-model path.
Shared schema, two pages. Because create and edit now share a layout, put your custom fields in the package's schema class/method (or a BusinessCardForm you own) rather than duplicating them per page. Any field you add automatically appears in both screens and in the preview modal — that's the whole payoff of the unified layout.
Preview from live state. The modal is populated from the Filament form's current state (roughly $this->form->getState() inside a ->modalContent() closure), not from a saved model. Build your card Blade partial so it accepts a plain array:
->modalContent(fn () => view('business-cards.preview', [
'card' => $this->form->getState(),
]))
Rendering that same partial from your public card route keeps preview and reality honest — if they diverge, users lose trust in the preview.
Make state live. For the preview to feel responsive, mark the fields that matter with ->live() (or ->live(onBlur: true) for text inputs and rich editors) so the modal reflects edits. Reserve onBlur for anything expensive; plain live() on a debounced text field is usually fine.
Two-step workflow. A common day-to-day pattern: draft with the preview modal open, iterate on copy/avatar, then save once. Encourage this in your UI by placing the preview action next to the submit button rather than in the page header.
Integration tips. If you generate public slugs, use the same value the preview shows as a hint ("this card will live at /c/acme-jane"), and derive it from the same state array. If cards are tenant-scoped, ensure the resource query and the preview both respect the current tenant — the preview should never reveal another tenant's data.
TemporaryUploadedFile (e.g. ->temporaryUrl()); anything that calls a persisted media conversion or Storage::url() on a non-existent path will 404 or throw.getState() is dehydrated state, not your model. Repeaters arrive as arrays, rich text as raw HTML (sanitize it), dates as strings. Treat the preview input as untrusted.modalContent() is evaluated when the modal opens; if ->live() isn't set on the fields you care about, edits made while the modal is open won't refresh. Debug by dumping the state inside the closure.->live() on many fields, users see validation errors mid-typing. Debounce, or restrict live to display fields and leave validation on submit.composer.json declares and re-check the preview action after any minor Filament bump.How can I help you explore Laravel packages today?