mercredi 15 août 2018

get dynamic value laravel eloquent relation blade

I have method like this

 public function addAtAttribute($items){
 foreach ($items as $item) {
        $result[] = "$temp[0]->$temp[1]";
    }
 return $result;
 }

When I print_r($result) on my controller show me:

Array ( [0] => User->city [1] => User->name [2] => User->email [3] => User->phone )

and my blade I have this and dose not show anything

  @foreach($tdRows as  $key=>$value)
       <td class="text-lg-left text-md-left" data-label="">
             <label></label>
       </td>
  @endforeach

and when I add this on my blade show me User->city,..... and when I type use this on my blade show me true date.

      @foreach($tdRows as  $key=>$value)
       <td class="text-lg-left text-md-left" data-label="">
             <label></label>
       </td>
  @endforeach



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire