1234567891011121314151617181920 |
- <?php
- namespace App\Models;
- class PaymentMethod extends Model
- {
- protected $table = 'payment_method';
- public function customer(){
- return $this->hasOne(Customer::class, 'id', 'customer_id');
- }
- public function displayName(){
- $parsed = json_decode($this->detail_json);
- if(!@$parsed->card){
- return "Card ending in <b>{$this->card_last_four}</b>";
- }
- return "<b>{$parsed->card->brand}</b> ending in <b>{$parsed->card->last4}</b>, expiring {$parsed->card->exp_month} / {$parsed->card->exp_year}";
- }
- }
|