add the following code to the Item model
class Item extends Eloquent {
protected $appends = array('cents');
public function getCentsAttribute()
{
return substr($this->attributes['price'], -2);
}
}
sseffa said:
add the following code to the Item model
class Item extends Eloquent { protected $appends = array('cents'); public function getCentsAttribute() { return substr($this->attributes['price'], -2); } }
Thanks, I tried that, but it really makes no difference in this case.
I guess this could somehow have to do with autoloading of the helper functions.
I had some bad luck here... This issue was fixed five months ago, but my Laravel installation is older! >:(
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community