Advertisement

Responsive Advertisement

Accessors and mutator Laravel 9

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)));
}

Posting Komentar

0 Komentar