Closed newtonianb closed 11 years ago
This has nothing to do with the presenter. You are creating an exception because you are using eloquent wrong. You would get the same error without the presenter just with Illuminate\View\View::__toString()
instead. Your posts
method is a query builder instance and not a relationship therefore it doesn't have getResults
which is what relationships use. Which I expect is what your exception actually is, call to undefined method getResults.
Make your method...
public function posts()
{
return $this->hasMany('Post', 'receiver_id');
}
or something similar.
ah ok thanks!
I have a method in my model
From my view when I call
$user->posts
I getPHP Fatal error: Method Robbo\Presenter\View\View::__toString() must not throw an exception
And it hangs my entire apache on windows.
The only way I got this to work is if I change my posts function in the model to
and my call in the view to
$user->posts()