Laravel4: Call to a member function on a non-object

Posted by s0hno on Stack Overflow See other posts from Stack Overflow or by s0hno
Published on 2013-10-19T10:07:49Z Indexed on 2013/10/19 15:54 UTC
Read the original article Hit count: 237

Filed under:
|
|

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?

© Stack Overflow or respective owner

Related posts about php

Related posts about laravel