I have been scratching my head over this one, hopefully a super simple answer.
I am using andrewelkins' (excellent!) start site to learn the ways of Laravel, which can be found over at https://github.com/andrewelkins/Laravel-4-Bootstrap-Starter-Site. This starter-site is a simple blog-system, to get to know Laravel.
In one of the controllers (to be specific: AdminBlogsController.php) I see the following code:
public function getIndex()
{
// Title
$title = Lang::get('admin/blogs/title.blog_management');
//Grab all the blog posts
$posts = $this->post;
// Show the page
return View::make('admin/blogs/index', compact('posts', 'title'));
}
What bothers me, how can you call $this->post
without calling something like all();
to get all records.
In every other tutorial I see something like $this->post->all()
, but not here. Do note, that this code without the all()
works.