card action

This commit is contained in:
2025-01-26 14:42:47 +03:00
parent 08cdf44b67
commit 824130df26
27 changed files with 430 additions and 53 deletions

View File

@ -14,7 +14,7 @@ use kernel\modules\user\models\User;
* @property int $payment_type
* @property int $bank_id
* @property int $info
* @property int $program
* @property int $card_program_id
* @property int $cvc
* @property int $pin
* @property int $card_template_id
@ -28,7 +28,7 @@ class Card extends Model
protected $table = 'card';
protected $fillable = ['user_id', 'payment_type', 'balance', 'bank_id', 'info', 'program', 'cvc', 'pin', 'username', 'card_template_id', 'card_file_id', 'status'];
protected $fillable = ['user_id', 'payment_type', 'balance', 'bank_id', 'info', 'card_program_id', 'cvc', 'pin', 'username', 'card_template_id', 'card_file_id', 'status'];
public static function labels(): array
{
@ -46,7 +46,7 @@ class Card extends Model
'balance' => 'Баланс',
'bank_id' => 'ID банка',
'info' => 'Информация о банке',
'program' => 'Программа',
'card_program_id' => 'Программа',
'cvc' => 'CVC',
'pin' => 'PIN',
'username' => 'Username',
@ -72,6 +72,11 @@ class Card extends Model
return $this->belongsTo(CardTemplate::class);
}
public function cardProgram(): \Illuminate\Database\Eloquent\Relations\BelongsTo
{
return $this->belongsTo(related: CardProgram::class);
}
public function cardFile(): \Illuminate\Database\Eloquent\Relations\BelongsTo
{
return $this->belongsTo(CardFile::class);

View File

@ -37,6 +37,11 @@ class CardProgram extends Model
];
}
public function cardProgramConditions(): \Illuminate\Database\Eloquent\Relations\HasMany
{
return $this->hasMany(CardProgramConditions::class);
}
/**
* @return string[]
*/

View File

@ -7,6 +7,8 @@ use Illuminate\Database\Eloquent\Model;
/**
* @property integer $from
* @property integer $to
* @property integer $from_balance
* @property integer $to_balance
* @property integer $amount
* @property integer $type
* @property integer $status
@ -20,7 +22,7 @@ class CardTransaction extends Model
protected $table = 'card_transaction';
protected $fillable = ['from', 'to', 'amount', 'type', 'status'];
protected $fillable = ['from', 'from_balance', 'to', 'to_balance', 'amount', 'type', 'status'];
public static function labels(): array
{

View File

@ -23,7 +23,7 @@ class CreateCardForm extends FormModel
'balance' => 'alpha-numeric',
'bank_id' => 'required|alpha-numeric',
'info' => 'required|alpha-numeric',
'program' => 'required|alpha-numeric',
'card_program_id' => 'required|alpha-numeric',
'cvc' => 'required|alpha-numeric',
'pin' => 'required|alpha-numeric',
'username' => 'required|min-str-len:5|max-str-len:20',

View File

@ -19,7 +19,9 @@ class CreateCardTransactionForm extends FormModel
// ];
return [
'from' => 'required|alpha-numeric',
'from_balance' => 'alpha-numeric',
'to' => 'required|alpha-numeric',
'to_balance' => 'alpha-numeric',
'amount' => 'required|alpha-numeric',
'type' => 'required|alpha-numeric',
'status' => ''