diff --git a/plugins/rainlab/user/models/User.php b/plugins/rainlab/user/models/User.php
index bdededbc2..698701bc4 100644
--- a/plugins/rainlab/user/models/User.php
+++ b/plugins/rainlab/user/models/User.php
@@ -52,7 +52,8 @@ class User extends UserBase
];
public $hasMany = [
- 'products' => ['TPS\Birzha\Models\Product', 'key' => 'vendor_id']
+ 'products' => ['TPS\Birzha\Models\Product', 'key' => 'vendor_id'],
+ 'transaction' => ['TPS\Birzha\Models\Transaction']
];
/**
diff --git a/plugins/tps/birzha/Plugin.php b/plugins/tps/birzha/Plugin.php
index ffb580a6f..ebfbcdbb4 100644
--- a/plugins/tps/birzha/Plugin.php
+++ b/plugins/tps/birzha/Plugin.php
@@ -62,8 +62,9 @@ class Plugin extends PluginBase
case 'draft' : return ''.$value.'';
case 'bank' : return ''.$value.'';
case 'online' : return ''.$value.'';
+ case 'gift' : return ''.$value.'';
+ case 'payed':
case 'approved' : return ''.$value.'';
- case 'payed' : return ''.$value.'';
case 'new' : return ''.$value.'';
case 'denied' : return ''.$value.'';
case 'disabled' : return ''.$value.'';
diff --git a/plugins/tps/birzha/models/Payment.php b/plugins/tps/birzha/models/Payment.php
index 7fe4ca6a6..237302bb1 100644
--- a/plugins/tps/birzha/models/Payment.php
+++ b/plugins/tps/birzha/models/Payment.php
@@ -26,8 +26,8 @@ class Payment extends Model
'amount' => 'required|gt:0'
];
- public $hasMany = [
- 'offers' => 'TPS\Birzha\Models\Offer'
+ public $morphOne = [
+ 'transaction' => [Transaction::class, 'name' => 'transactable']
];
public $belongsTo = [
diff --git a/plugins/tps/birzha/models/Product.php b/plugins/tps/birzha/models/Product.php
index fc1a54f20..0766bf988 100644
--- a/plugins/tps/birzha/models/Product.php
+++ b/plugins/tps/birzha/models/Product.php
@@ -57,6 +57,10 @@ class Product extends Model
'payment' => ['TPS\Birzha\Models\Payment'],
];
+ public $morphOne = [
+ 'transaction' => [Transaction::class, 'name' => 'transactable']
+ ];
+
public $attachMany = [
'images' => 'System\Models\File'
];
diff --git a/plugins/tps/birzha/models/Transaction.php b/plugins/tps/birzha/models/Transaction.php
new file mode 100644
index 000000000..672589fd4
--- /dev/null
+++ b/plugins/tps/birzha/models/Transaction.php
@@ -0,0 +1,21 @@
+ []
+ ];
+
+ protected $fillable = ['amount'];
+
+ public $belongsTo = [
+ 'user' => 'RainLab\User\Models\User'
+ ];
+}
diff --git a/plugins/tps/birzha/models/payment/fields.yaml b/plugins/tps/birzha/models/payment/fields.yaml
index 6616c3d0b..def4183fd 100644
--- a/plugins/tps/birzha/models/payment/fields.yaml
+++ b/plugins/tps/birzha/models/payment/fields.yaml
@@ -24,6 +24,7 @@ fields:
options:
bank: Bank
online: Online
+ gift: Gift
span: auto
readOnly: 1
type: balloon-selector