php - foreach in blade template not working correctly -
i'm having issues on displaying data foreach loop. have 400+ thumbs on database laravel doesn't not work correctly, , footer template didn't display too. put code below.
@foreach($thumbs $thumb) {{$thumb['name']}} {{$thumb['desc']}} {{$thumb['place']}} @endforeach myfooter code goes here.
from controllers
$data['thumbs'] = thumb::all(); return view('tubetour/home',$data);
but when tried var_dump or return value of thumbs on controller displays 400+ data.
$data['thumbs'] = thumb::all(); return $data['thumbs'];
you need pass associative array second argument view
function:
// controller $thumbs = thumb::all(); return \view::make('tubetour.home', ['thumbs' => $thumbs]); // view @foreach($thumbs $thumb) {{ $thumb->name }} {{ $thumb->desc }} {{ $thumb->place }} @endforeach
edit: if using laravel 4 need use view::make()
Comments
Post a Comment