Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with enums #89

Open
rabol opened this issue Oct 19, 2023 · 1 comment
Open

Problems with enums #89

rabol opened this issue Oct 19, 2023 · 1 comment

Comments

@rabol
Copy link

rabol commented Oct 19, 2023

while using a enum in a blade I get this

Parameter #1 (App\Enums\PlaceholderTypeEnum::Checkbox) of echo cannot be converted to string.

it is uses like this:

<x-native-select
        label="{{ __('Select type') }}"
        wire:model="placeholders.{{ $key }}.type"
        placeholder="{{ __('Select type') }}">
    <option value="">{{ __('Select type') }}</option>
    <option value="{{PlaceholderTypeEnum::Checkbox }}">{{ __('Checkbox') }}</option>
    <option value="{{PlaceholderTypeEnum::Number }}">{{ __('Number') }}</option>
    <option value="{{PlaceholderTypeEnum::Date }}">{{ __('Date') }}</option>
    <option value="{{PlaceholderTypeEnum::Today}}">{{ __('Today') }}</option>
    <option value="{{PlaceholderTypeEnum::Text }}">{{ __('Text') }}</option>
    <option value="{{PlaceholderTypeEnum::Email }}">{{ __('Email') }}</option>
    <option value="{{PlaceholderTypeEnum::Signature }}">{{ __('Signature') }}</option>
    <option value="{{PlaceholderTypeEnum::Decimal }}">{{ __('Decimal') }}</option>
    <option value="{{PlaceholderTypeEnum::YesNo }}">{{ __('YesNo') }}</option>
    <option value="{{PlaceholderTypeEnum::UploadPDF }}">{{ __('Upload pdf') }}</option>
    <option value="{{PlaceholderTypeEnum::UploadImage }}">{{ __('Upload image') }}</option>
  </x-native-select>
@AJenbo
Copy link
Contributor

AJenbo commented Oct 19, 2023

Laravel/Blade it self still have many in accurate type hints. You can get around this one by using the value manually:


    <option value="{{PlaceholderTypeEnum::Today->value}}">{{ __('Today') }}</option>
    <option value="{{PlaceholderTypeEnum::Text->value }}">{{ __('Text') }}</option>
    <option value="{{PlaceholderTypeEnum::Email->value }}">{{ __('Email') }}</option>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants