Laravel4: Call to a member function on a non-object
- by s0hno
The following code will throw an error
Call to a member function `links()` on a non-object
routes.php:
Route::get('videos', function(){
$data = DB::table('video_data_r')->paginate(5);
return View::make('video',$data);
});
Corresponding video view:
<?php foreach($data as $item): ?>
<div class="video_entry">
<a href="<?php echo $item -> url; ?>" target="_blank"><img src="<?php echo $item -> thumb; ?>" /></a>
<a href="<?php echo $item -> url; ?>" target="_blank"><?php echo $item -> title; ?>"</a>
</div>
<?php endforeach; ?>
<?php echo $data->links();?>
Could you give me a good hint on what looks like a trivial error?