Home:ALL Converter>Laravel Blade : Accessing object properties dynamically

Laravel Blade : Accessing object properties dynamically

Ask Time:2018-08-23T15:19:53         Author:Kusal Dissanayake

Json Formatter

Im trying to access a property of an object by a dynamic property name within Laravel Blade file. Im getting the following error

ErrorException (E_ERROR) Object of class stdClass could not be converted to string (View: /Users/kusal/Sites/laravel/masterdata/MD.UI/views/update.blade.php)

Code:

{{ $data->$control->value_column }}

I want to access the $control->value_column of $data.

Author:Kusal Dissanayake,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/51980314/laravel-blade-accessing-object-properties-dynamically
yy