Created
January 1, 2015 00:20
-
-
Save atkaye/3da5db88bdb378dcf7d6 to your computer and use it in GitHub Desktop.
Setting the currency with Laravel Cashier
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 | |
| use Illuminate\Auth\UserInterface; | |
| use Illuminate\Auth\Reminders\RemindableInterface; | |
| use Laravel\Cashier\BillableInterface; | |
| use Illuminate\Auth\UserTrait; | |
| use Illuminate\Auth\Reminders\RemindableTrait; | |
| use Laravel\Cashier\BillableTrait; | |
| class User extends Model implements UserInterface, RemindableInterface, BillableInterface { | |
| use UserTrait, | |
| RemindableTrait, | |
| BillableTrait; | |
| /** | |
| * The database table used by the model. | |
| * | |
| * @var string | |
| */ | |
| protected $table = 'users'; | |
| /** | |
| * Get the Stripe supported currency used by the entity. | |
| * | |
| * @return string | |
| */ | |
| public function getCurrency() | |
| { | |
| return 'gbp'; | |
| } | |
| /** | |
| * Get the locale for the currency used by the entity. | |
| * | |
| * @return string | |
| */ | |
| public function getCurrencyLocale() | |
| { | |
| return 'en_GB'; | |
| } | |
| /** | |
| * Add the currency symbol to a given amount. | |
| * | |
| * @param string $amount | |
| * @return string | |
| */ | |
| public function addCurrencySymbol($amount) | |
| { | |
| return '£'.$amount; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment