jeudi 20 juillet 2017

Undefined property: Illuminate\Support\Collection::$election_name in view

In the controller, I store some data in an array.Then I want to send it in myelectionlist.blade.php

$my_election=[];
  $i=0; 
  foreach ($election_list as $election_list)
  {
          $my_election[$i]=DB::table('election')
                       ->where('id','=',$election_list->election_id)
                       ->get();
                       $i++;  
  }
 return view::make('myelectionlist')->with('election_list',$my_election);

I check with return $my_election, It works fine. But In mymyelectionlist.blade.php when I write

@for($i=0;$i<sizeof($election_list);$i++)                    

@endfor

It does not work.

Undefined property: Illuminate\Support\Collection::$election_name

happens, How to solve the problem?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2uOgaV0
via IFTTT

Aucun commentaire:

Enregistrer un commentaire