Voyager: Undefined property: stdClass::$ (View: \tcg\voyager\resources\views\bread\browse.blade.php)

Created on 1 Sep 2017  路  11Comments  路  Source: the-control-group/voyager

  • Laravel Version: 5.5
  • Voyager Version: tcg/voyager dev-master
  • PHP Version: 7.1
  • Database Driver & Version: MySQL

Description:

when i add Select Dropdown with bread with

{
"default": "0",
"options": {
"0": "NO",
"1": "YES"
}
}

i see this error Undefined property: stdClass::$ (View: D:\LMS\vendor\tcg\voyager\resources\views\bread\browse.blade.php)

All 11 comments

Labels: invalid

  • Laravel Version: 5.5.13
  • Voyager Version: 1.0.4
  • PHP Version: 7.1.10
  • Database Driver & Version: MySQL 5.7.19

Description:

After activation to display parent category in browse the following exception has been thrown:

Undefined property: stdClass::$1 (View: vendor/tcg/voyager/resources/views/bread/browse.blade.php)

on line 115

$options->options->{$data->{$row->field}};

The relation list seems not to be loaded (only the custom options entry -- None --)

Steps To Reproduce:

  1. Create example category data (with a parent one)
  2. In categories bread activate parent_id visibility for browse

My parent id is using the following optional details:

{
     "default": "",
     "null": "",
     "options": {
         "": "-- None --"
     },
     "relationship": {
         "key": "id",
         "label": "name"
     }
}

This happens on browse only i think with many to many or one to many relationships. Try to remove browse relationship and use all the other.

Same issue here, does not happen if none of the items have a relationship set. If one has a relationship set it doesn't work until options are removed.

same error i faced. i just copy the selectbox option's json code from voyager documentation

{
    "default" : "option1",
    "options" : {
        "option1": "Option 1 Text",
        "option2": "Option 2 Text"
    }
}

but i am still getting this error

Read the P.S. before!

Almost same error when I have Drop-down and brows is enable.
When I click on bread to browse category model(Cat), Laravel throw an error.
It shows only on brows page and in a same time parent relationship on the edit page(example.com/admin/model/1/edit) is working.
I tried without display option and it still there.

{
    "default": "",
    "null": "",
    "options": {
        "": "-- None --"
    },
    "relationship": {
        "key": "id",
        "label": "name"
    },
    "display": {
        "width": "4"
    }
}

Error on:

                                           <?php echo $options->options->{$data->{$row->field}}; ?>

Error message:

ErrorException thrown with message "Undefined property: stdClass::$3 (View: /var/www/html/a/vendor/tcg/voyager/resources/views/bread/browse.blade.php)"

Stacktrace:
#60 ErrorException in /var/www/html/a/storage/framework/views/63b4605e83cb69445b180b475ac10f80b09f333b.php:120
#59 ErrorException in /var/www/html/a/storage/framework/views/63b4605e83cb69445b180b475ac10f80b09f333b.php:120
#58 Illuminate\Foundation\Bootstrap\HandleExceptions:handleError in /var/www/html/a/storage/framework/views/63b4605e83cb69445b180b475ac10f80b09f333b.php:120

P.S. While I was gathering details for this problem I found out a reason.
I forgot to create relationship on bread edit form!
After adding parent relation it working now.
If you add 'Belongs To relationship on bread, Your drop-down will be invisible and the auto-generate drop-down will appears. But Has Many won't hurt anything and it give you a child's column on browse page and a list on edit form.
Main issue is we can have customize drop-down while we have Belongs To relationship.
screenshot from 2018-02-06 22-15-05

I know this is a bit old, but all comments here are not related to the original issue.
The original issue seems related to https://github.com/the-control-group/voyager/issues/1001
If so, this is a duplicate.

Duplicating my comment from #1001 in case it helps:

For me this error was solved with the exclusion of a null value:-

/vendor/tcg/voyager/resources/views/bread/browse.blade.php

Line 118
@unless(empty($options->options->{$data->{$row->field}}))
     {!! $options->options->{$data->{$row->field}} !!}
@endunless

*Edit: Appears to work with relationships. Let me know if it solves for you and I will submit PR *

Closing this as its a duplicate of #1001

Hi, for me this error was solved with

{!! $options->options->{$data->{$row->field}} or $data->{$row->field} !!}
parent_drop_down

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

abacram picture abacram  路  3Comments

MikadoInfo picture MikadoInfo  路  3Comments

popica80 picture popica80  路  3Comments

iwasherefirst2 picture iwasherefirst2  路  3Comments

duongsieu picture duongsieu  路  3Comments