first
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace kernel\app_modules\user_custom_fields\models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use kernel\modules\user\models\User;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property int $user_id
|
||||
* @property int $custom_field_id
|
||||
* @property string $value
|
||||
* @property string $created_at
|
||||
* @property string $updated_at
|
||||
*/
|
||||
class UserCustomValues extends Model
|
||||
{
|
||||
|
||||
const DISABLE_STATUS = 0;
|
||||
const ACTIVE_STATUS = 1;
|
||||
|
||||
protected $table = 'user_custom_values';
|
||||
|
||||
protected $fillable = ['user_id', 'custom_field_id', 'value'];
|
||||
|
||||
public static function labels(): array
|
||||
{
|
||||
return [
|
||||
'user_id' => 'ID пользователя',
|
||||
'custom_field_id' => 'ID кастомного поля',
|
||||
'value' => 'Значение',
|
||||
'created_at' => 'Дата создания',
|
||||
'updated_at' => 'Дата обновления',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public static function getStatus(): array
|
||||
{
|
||||
return [
|
||||
self::DISABLE_STATUS => "Не активный",
|
||||
self::ACTIVE_STATUS => "Активный",
|
||||
];
|
||||
}
|
||||
|
||||
public function customField(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
{
|
||||
return $this->belongsTo(CustomField::class);
|
||||
}
|
||||
|
||||
public function user(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user