jeudi 30 mars 2017

array to string conversion in laravel

I am trying to fetch some data from table in laravel 5.0 like so

 <div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
 {!! $moduleCategories = DB::table('module_categories')->select('categories_name')->where('modules_id','=',$modules->id)->get() !!}
 @foreach($moduleCategories as $category)
     <a class="dropdown-item" href="#"></a>
 @endforeach
 </div>

$module->id is obtained from another query result. Now when I try to run this I am getting Array to string conversion. Can someone point out the mistake. The expected output is > 1 in the sense there can be multiple categories names matching that condition.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire