Skip to content

Instantly share code, notes, and snippets.

@atkaye
Created January 1, 2015 00:20
Show Gist options
  • Save atkaye/3da5db88bdb378dcf7d6 to your computer and use it in GitHub Desktop.
Save atkaye/3da5db88bdb378dcf7d6 to your computer and use it in GitHub Desktop.
Setting the currency with Laravel Cashier
<?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