Laravel 4 Model Methods access
am I doing something wrong to be able to access Methods stored in a model
in a view. For Example. My User model has a method that looks like
public function isCustomer(){
if (isset($this->customer_id))
return true;
else return false;
}
When I try to access this in the view I end up with Call to a member
function getResults() on a non-object.
View code is something like
@if($user->isCustomer)
Something
@endif
Is the model ONLY for database relationships between models or can I store
my own class functions here as well?
The function i listed is one of the basic ones. I have quite a few more
complicated functions that I would like to run from my User class but am
not sure how, as i end up with the same error each time. Should they be
stored in the controller?
No comments:
Post a Comment