1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 08:21:34 +02:00
invoiceninja/app/Models/AccountGateway.php
2015-04-15 19:35:41 +03:00

39 lines
903 B
PHP

<?php namespace App\Models;
use App\Models\Gateway;
use Illuminate\Database\Eloquent\SoftDeletes;
class AccountGateway extends EntityModel
{
use SoftDeletes;
protected $dates = ['deleted_at'];
public function gateway()
{
return $this->belongsTo('App\Models\Gateway');
}
public function getCreditcardTypes()
{
$flags = unserialize(CREDIT_CARDS);
$arrayOfImages = [];
foreach ($flags as $card => $name) {
if (($this->accepted_credit_cards & $card) == $card) {
$arrayOfImages[] = ['source' => asset($name['card']), 'alt' => $name['text']];
}
}
return $arrayOfImages;
}
public function getPaymentType() {
return Gateway::getPaymentType($this->gateway_id);
}
public function isPaymentType($type) {
return $this->getPaymentType() == $type;
}
}