mivita/app/Models/ShoppingPayment.php
2019-02-28 18:09:54 +01:00

52 lines
No EOL
1.1 KiB
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class ShoppingPayment extends Model
{
protected $table = 'shopping_payments';
protected $fillable = [
'shopping_order_id',
'clearingtype',
'wallettype',
'onlinebanktransfertype',
'reference',
'amount',
'currency',
];
public function shopping_order()
{
return $this->belongsTo('App\Models\ShoppingOrder','shopping_order_id');
}
public function payment_transactions()
{
return $this->hasMany('App\Models\PaymentTransaction','shopping_payment_id');
}
public function getPaymentType(){
if($this->clearingtype == 'wlt') {
if ($this->wallettype == 'PPE') {
return 'PayPal';
}
}
if($this->clearingtype == 'cc') {
return 'Kreditkarte';
}
if($this->clearingtype == 'vor') {
return 'Vorkasse';
}
if($this->clearingtype == 'sb') {
if ($this->onlinebanktransfertype == 'PNT') {
return 'Sofort Überweisung';
}
}
}
}