Created
January 7, 2020 02:30
-
-
Save zhanang19/b8864cff99ab7750c9ac2c19783fb6a2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App; | |
use Illuminate\Database\Eloquent\Model; | |
class Product extends Model | |
{ | |
/** | |
* Get the formatted price. | |
* | |
* @return string | |
*/ | |
public function getFormattedPriceAttribute() | |
{ | |
return 'Rp. ' . number_format(this->attributes['price'], 0, ',', '.'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment