PaymentMethod.php 462 B

1234567891011121314151617
  1. <?php
  2. namespace App\Models;
  3. class PaymentMethod extends Model
  4. {
  5. protected $table = 'payment_method';
  6. public function customer(){
  7. return $this->hasOne(Customer::class, 'id', 'customer_id');
  8. }
  9. public function displayName(){
  10. $parsed = json_decode($this->detail_json);
  11. return "<b>{$parsed->card->brand}</b> ending in <b>{$parsed->card->last4}</b>, expiring {$parsed->card->exp_month} / {$parsed->card->exp_year}";
  12. }
  13. }