the solution must be simple but i cant see it
Iam passing an array to the view, whit all the fields that i want to display in a table, and whats the name of the attribute. When this attributes are from the class i have no problem. When correspond to a related object echos nothing.
Array example:
$fields = [
[
'field' => 'id_user',
'det' => 'Id user',
'class' => 'sorting',
'index' => '1',
],
[
'field' => 'rol->Name',
'det' => 'Rol',
'class' => '',
'index' => '5',
],
@foreach($fields as $f)
<td>{!! $user->$f['field'] !!}</td>
@endforeach
if i hardcode $user->rol->Name works perfectly, so the objects and the relationship i assume is well formed.
THKS!!!!
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community