In Laravel 3, one could do the following in the model (http://laravel.com/docs/database/eloquent#eager):
class Book extends Eloquent
{
public $includes = array('author'); // this line
public function author()
{
return $this->belongs_to('Author');
}
}
which was useful if loading the same models often.
In Laravel 4, adding "this line" doesn't seem to do cause eager loading though. It also doesn't seem to be mentioned in the docs (http://four.laravel.com/docs/eloquent#eager-loading).
Has it been replaced by something else or is this functionality simply gone?
Update:
I've looked at the source for model (so nice to read). It's now:
/**
* The relations to eager load on every query.
*
* @var array
*/
protected $with = array();
Is there any way that I can suggest this to be added (back) to the documentation (it seems like one of those little things that can easily be overlooked)?