server test version
This commit is contained in:
85
kernel/app_modules/card/models/Card.php
Normal file
85
kernel/app_modules/card/models/Card.php
Normal file
@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
namespace kernel\app_modules\card\models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use kernel\modules\user\models\User;
|
||||
|
||||
// Добавить @property
|
||||
/**
|
||||
* @property int $id
|
||||
* @property int $status
|
||||
* @property int $balance
|
||||
* @property int $user_id
|
||||
* @property int $payment_type
|
||||
* @property int $bank_id
|
||||
* @property int $info
|
||||
* @property int $program
|
||||
* @property int $cvc
|
||||
* @property int $pin
|
||||
* @property int $card_template_id
|
||||
* @property int $card_file_id
|
||||
* @property string $username
|
||||
*/
|
||||
class Card extends Model
|
||||
{
|
||||
const DISABLE_STATUS = 0;
|
||||
const ACTIVE_STATUS = 1;
|
||||
|
||||
protected $table = 'card';
|
||||
|
||||
protected $fillable = ['user_id', 'payment_type', 'balance', 'bank_id', 'info', 'program', 'cvc', 'pin', 'username', 'card_template_id', 'card_file_id', 'status'];
|
||||
|
||||
public static function labels(): array
|
||||
{
|
||||
// Заполнить массив
|
||||
// Пример: [
|
||||
// 'label' => 'Заголовок',
|
||||
// 'entity' => 'Сущность',
|
||||
// 'slug' => 'Slug',
|
||||
// 'status' => 'Статус',
|
||||
// ]
|
||||
|
||||
return [
|
||||
'user_id' => 'ID пользователя',
|
||||
'payment_type' => 'Платежная система',
|
||||
'balance' => 'Баланс',
|
||||
'bank_id' => 'ID банка',
|
||||
'info' => 'Информация о банке',
|
||||
'program' => 'Программа',
|
||||
'cvc' => 'CVC',
|
||||
'pin' => 'PIN',
|
||||
'username' => 'Username',
|
||||
'card_template_id' => 'Шаблон',
|
||||
'card_file_id' => 'Карта',
|
||||
'status' => 'Статус',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public static function getStatus(): array
|
||||
{
|
||||
return [
|
||||
self::DISABLE_STATUS => "Не активный",
|
||||
self::ACTIVE_STATUS => "Активный",
|
||||
];
|
||||
}
|
||||
|
||||
public function cardTemplate(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
{
|
||||
return $this->belongsTo(CardTemplate::class);
|
||||
}
|
||||
|
||||
public function cardFile(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
{
|
||||
return $this->belongsTo(CardFile::class);
|
||||
}
|
||||
|
||||
// public function user(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
// {
|
||||
// return $this->belongsTo(User::class);
|
||||
// }
|
||||
|
||||
}
|
Reference in New Issue
Block a user