lara-zeus / qr

QR Code Field with designing options
MIT License
36 stars 10 forks source link

Typed property LaraZeus\Qr\Components\Qr::$optionsColumn must not be accessed before initialization #10

Closed yann-yvan closed 7 months ago

yann-yvan commented 8 months ago

Typed property LaraZeus\Qr\Components\Qr::$optionsColumn must not be accessed before initialization

usage :

$table ->actions([ // Tables\Actions\ViewAction::make(), Action::make("Qr") ->label("Scan") ->icon("heroicon-o-qr-code") ->fillForm(fn(HealthBook $record): array => [ 'code' => "https://api.qrserver.com/v1/create-qr-code/?size=250x250&data=" . $record->{HealthBook::SEQUENCE}, ])->form([ \LaraZeus\Qr\Components\Qr::make('code'), ]) ->modalFooterActions() ->slideOver() ]);

atmonshi commented 8 months ago

can you add ->optionsColumn('string')

and see if it works?

\LaraZeus\Qr\Components\Qr::make('code')
                            ->optionsColumn('options'),
atmonshi commented 8 months ago

I did a smal update to fix this

and to use the QR code with table actions, you can use this

Action::make('qr-action')
    ->fillForm(fn(Model $record) => [
        'qr-options' => Qr::getDefaultOptions(),// or $record->qr-options
        'qr-data' => 'https://',// or $record->url
    ])
    ->form(Qr::getFormSchema('qr-data', 'qr-options'))
    ->action(fn($data) => dd($data)),