Files
online.tbbank.gov.tm-larave…/app/Models/Order/Card/CardPin/CardPin.php
2025-09-09 10:48:46 +05:00

136 lines
2.9 KiB
PHP

<?php
namespace App\Models\Order\Card\CardPin;
use App\Models\Branch\Branch;
use App\Models\Order\Card\CardType;
use App\Models\User;
use App\Repos\Order\Loan\LoanOrderRepo;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
/**
* @property int $id
* @property null|string $unique_id
* @property int $card_type_id
* @property string $card_number
* @property string $region
* @property int $branch_id
* @property string $customer_name
* @property string $customer_surname
* @property null|string $customer_patronic_name
* @property null|string $born_at
* @property null|string $phone
* @property string $passport_serie
* @property string $passport_id
* @property null|string $status
* @property null|string $passport_one
* @property null|string $passport_two
* @property null|string $passport_three
* @property null|string $passport_four
* @property null|string $notes
* @property int $user_id
* @property null|string $created_at
* @property null|string $updated_at
* @property null|string $deleted_at
*/
class CardPin extends Model
{
use HasFactory;
use SoftDeletes;
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'unique_id',
'card_type_id',
'card_number',
'region',
'branch_id',
'customer_name',
'customer_surname',
'customer_patronic_name',
'born_at',
'phone',
'passport_serie',
'passport_id',
'status',
'passport_one',
'passport_two',
'passport_three',
'passport_four',
'notes',
'user_id',
];
/**
* The attributes that should be cast.
*
* @var array<string, string>
*/
protected $casts = [
'born_at' => 'date',
];
/**
* User
*
* @return BelongsTo<User, CardPin>
*/
public function user(): BelongsTo
{
return $this->belongsTo(User::class);
}
/**
* Card type
*
* @return BelongsTo<CardType, CardPin>
*/
public function cardType(): BelongsTo
{
return $this->belongsTo(CardType::class, 'card_type_id');
}
/**
* Branch
*
* @return BelongsTo<Branch, CardPin>
*/
public function branch(): BelongsTo
{
return $this->belongsTo(Branch::class, 'branch_id');
}
/**
* Return ID ))
*/
public function really(): int
{
return $this->id;
}
/**
* Price for order
*/
public function priceAmount(): float
{
return 3.02;
}
/**
* "boot" method for model
*/
protected static function boot()
{
parent::boot();
static::created(LoanOrderRepo::created());
}
}