Files
tbbank-new/app/Modules/VisaMasterPaymentOrder/Models/VisaMasterPaymentOrder.php
2025-12-19 17:18:36 +05:00

120 lines
3.6 KiB
PHP

<?php
namespace App\Modules\VisaMasterPaymentOrder\Models;
use App\Models\User;
use App\Modules\Branch\Models\Branch;
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;
/**
* @property int $id
* @property string $unique_id
* @property string $type
* @property string $passport_name
* @property string $passport_surname
* @property string $phone
* @property string $email
* @property string $region
* @property string $address
* @property array<string, string> $sender_datas
* @property array<string, string> $payment_reciever
* @property array<string, string> $documents
* @property string $status
* @property ?string $notes
* @property string $sender_full_name
* @property string $sender_passport_serie
* @property string $sender_passport_number
* @property string $sender_deposit_account
* @property bool $paid
* @property \Illuminate\Support\Carbon $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @property \Illuminate\Support\Carbon|null $deleted_at
*/
class VisaMasterPaymentOrder extends Model implements HasMedia
{
use InteractsWithMedia;
use SoftDeletes;
protected $table = 'visa_master_payment_orders';
/**
* The attributes that should be cast.
*
* @var array<string, string>
*/
protected $casts = [
'sender_datas' => 'array',
'payment_reciever' => 'array',
];
/**
* User
*
* @return BelongsTo<User, $this>
*/
public function user(): BelongsTo
{
return $this->belongsTo(User::class);
}
/**
* Branch
*
* @return BelongsTo<Branch, $this>
*/
public function branch(): BelongsTo
{
return $this->belongsTo(Branch::class);
}
/**
* Payment itmes
*
* @return HasMany<VisaMasterPaymentOrderItem, $this>
*/
public function paymentItems(): HasMany
{
return $this->hasMany(VisaMasterPaymentOrderItem::class, 'visa_master_payment_order_id');
}
/**
* Get applications types
*
* @return array<string, string>
*/
public static function applicationTypes(): array
{
return [
'visa' => __('Visa'),
'master' => __('Master'),
];
}
/**
* Media collections
*/
public function registerMediaCollections(): void
{
$this->addMediaCollection('receiver_requisite')->singleFile();
$this->addMediaCollection('receiver_document_stating_he_is_studying')->singleFile();
$this->addMediaCollection('receiver_ticket')->singleFile();
$this->addMediaCollection('receiver_passport_local')->singleFile();
$this->addMediaCollection('receiver_passport_international')->singleFile();
$this->addMediaCollection('receiver_visa')->singleFile();
$this->addMediaCollection('receiver_travel_stamp_on_passport')->singleFile();
$this->addMediaCollection('receiver_document_stating_he_is_studying_2')->singleFile();
$this->addMediaCollection('sender_passport_local')->singleFile();
$this->addMediaCollection('sender_passport_international')->singleFile();
$this->addMediaCollection('sender_travel_stamp_on_passport')->singleFile();
$this->addMediaCollection('sender_proof_of_kinship')->singleFile();
$this->addMediaCollection('sender_passport_local_old')->singleFile();
$this->addMediaCollection('sender_passport_local_old_replacement')->singleFile();
}
}