- Laravel Version: 8.77.1
- PHP Version: 8.0
- Database Driver & Version: mysql
Description:
I am getting issue
Call to undefined method App\Models\Product::getLowestPriceAttribute()
Even though I have defined lowestPrice function that returns CastsAttribute.
public function lowestPrice()
{
return \Illuminate\Database\Eloquent\Casts\Attribute::get(function(){
return 0; #some calculation
});
}
Working:
$product->lowestPrice
Not Working:
$product->append('lowestPrice');
Throws
Call to undefined method App\Models\Product::getLowestPriceAttribute()