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

Promblem in Multiple Checkbox. count(): Argument #1 ($var) must be of type Countable|array #5478

Closed
imsyuan opened this issue Oct 25, 2021 · 2 comments

Comments

@imsyuan
Copy link

imsyuan commented Oct 25, 2021

Laravel version

8.53.1

PHP version

8.0.9

Voyager version

1.5.1

Database

5.6

Description

Getting TypeError when I using sample code in BREAD.

count(): Argument #1 ($var) must be of type Countable|array, stdClass given (View: /var/www/html/vendor/tcg/voyager/resources/views/bread/browse.blade.php

截圖 2021-10-25 下午2 51 34
)

Steps to reproduce

Put the sample code in BREAD
{ "options": { "checkbox1": "Checkbox 1 Text", "checkbox2": "Checkbox 2 Text" } }

截圖 2021-10-25 下午2 50 59

Expected behavior

fix it as below. add true into json_decode

file : tcg/voyager/sources/views/bread/browse.blade.php line 148 and line 149

@if (@count(json_decode($data->{$row->field}, true)) > 0)
    @foreach(json_decode($data->{$row->field}, true) as $item)

截圖 2021-10-25 下午2 55 55

Screenshots

No response

Additional context

No response

@emptynick
Copy link
Collaborator

Fixed in #5473

@github-actions
Copy link
Contributor

This issue has been automatically locked since there has not been any recent activity after it was closed. If you have further questions please ask in our Slack group.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants