sber
This commit is contained in:
@@ -6,6 +6,7 @@ use App\Models\Branch\Branch;
|
||||
use App\Repos\Order\Loan\LoanOrderRepo;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Spatie\MediaLibrary\HasMedia;
|
||||
use Spatie\MediaLibrary\InteractsWithMedia;
|
||||
@@ -186,4 +187,31 @@ class SberPaymentOrder extends Model implements HasMedia
|
||||
|
||||
static::creating(LoanOrderRepo::creating());
|
||||
}
|
||||
|
||||
/**
|
||||
* Price for order
|
||||
*/
|
||||
public function priceAmount(): float
|
||||
{
|
||||
return 250;
|
||||
}
|
||||
|
||||
/**
|
||||
* Panel url
|
||||
*/
|
||||
public function panelUrl(string $type = 'index'): string
|
||||
{
|
||||
return match ($type) {
|
||||
'index' => sprintf('%s/resources/nova-sber-payment-orders', config('nova.path')),
|
||||
default => config('nova.path'),
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Payment itmes
|
||||
*/
|
||||
public function paymentItems(): HasMany
|
||||
{
|
||||
return $this->hasMany(SberPaymentOrderItem::class, 'sber_payment_order_id');
|
||||
}
|
||||
}
|
||||
|
||||
46
app/Modules/SberPaymentOrder/Models/SberPaymentOrderItem.php
Normal file
46
app/Modules/SberPaymentOrder/Models/SberPaymentOrderItem.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\SberPaymentOrder\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Spatie\MediaLibrary\HasMedia;
|
||||
use Spatie\MediaLibrary\InteractsWithMedia;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property int $sber_payment_order_id
|
||||
* @property int $online_payment_history_id
|
||||
* @property ?string $payer_name
|
||||
* @property ?string $payer_card
|
||||
* @property ?string $payment_order_number
|
||||
* @property string $tmt_payment_amount
|
||||
* @property string $usd_payment_amount
|
||||
* @property bool $paid
|
||||
* @property \Illuminate\Support\Carbon $created_at
|
||||
* @property \Illuminate\Support\Carbon $updated_at
|
||||
*/
|
||||
class SberPaymentOrderItem extends Model implements HasMedia
|
||||
{
|
||||
use InteractsWithMedia;
|
||||
|
||||
/**
|
||||
* Table
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'sber_payment_orders';
|
||||
|
||||
/**
|
||||
* Guarded attributes
|
||||
*/
|
||||
protected $guarded = [];
|
||||
|
||||
/**
|
||||
* Parent order
|
||||
*/
|
||||
public function parent(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(SberPaymentOrder::class, 'sber_payment_order_id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user