https://laravel.com/docs/9.x/eloquent-mutators
// contoh accesor menggunakan append
// (menambahkan objek baru ke array)
protected $appends = ['rp_price'];
public function getRpPriceAttribute()
{
return
strtoupper(sprintf('%s', number_format($this->price)));
}
0 Komentar