On this page
Installation
Install Lara Zeus Qr by running the following commands in your Laravel project directory.
composer require lara-zeus/qr
Usage:
use it in your resource
\LaraZeus\Qr\Components\Qr::make('qr_code') // to open the designer as slide over instead of a modal ->asSlideOver() //you can set the column you want to save the QR design options, you must cast it to array in your model ->optionsColumn('string') // set the icon for the QR action ->actionIcon('heroicon-s-building-library') // more options soon ,
Render the QR Code.
you can render the QR code in any component that accept HTML using the QR Facade:
\LaraZeus\Qr\Facades\Qr::render(data:'dataOrUrl')
and it's accept these options:
?string $data = null,?array $options = null,string $statePath = 'url',string $optionsStatePath = 'options',bool $downloadable = true
Usage with Table and Infolist
to insert the QR code in any FilamentPHP table or infolist, it's better to be displayed in a popover or modal,
and you can use our plugin Popover:
PopoverEntry::make('name') ->trigger('click') ->placement('right') ->offset([0, 10]) ->popOverMaxWidth('none') ->icon('heroicon-o-chevron-right') ->content(\LaraZeus\Qr\Facades\Qr::render(data:'dataOrUrl')),
Usage with any action
to use the QR code as an action in anywhere you want:
Action::make('qr-action') ->fillForm(fn(Model $record) => [ 'qr-options' => \LaraZeus\Qr\Facades\Qr::getDefaultOptions(),// or $record->qr-options 'qr-data' => 'https://',// or $record->url ]) ->form(\LaraZeus\Qr\Facades\Qr::getFormSchema('qr-data', 'qr-options')) ->action(fn($data) => dd($data)),