first
This commit is contained in:
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace kernel\app_modules\gestalt_profile_relationship\models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use kernel\app_modules\gestalt_profile\models\Gestalt_profile;
|
||||
|
||||
// Добавить @property
|
||||
/**
|
||||
* @property int $id
|
||||
* @property int $gestalt_profile_id
|
||||
* @property int $entity_id
|
||||
* @property string $entity
|
||||
*/
|
||||
class GestaltProfileRelationship extends Model
|
||||
{
|
||||
const DISABLE_STATUS = 0;
|
||||
const ACTIVE_STATUS = 1;
|
||||
|
||||
protected $table = 'gestalt_profile_relationship';
|
||||
|
||||
protected $fillable = ['gestalt_profile_id', 'entity', 'entity_id'];
|
||||
|
||||
public static function labels(): array
|
||||
{
|
||||
// Заполнить массив
|
||||
// Пример: [
|
||||
// 'label' => 'Заголовок',
|
||||
// 'entity' => 'Сущность',
|
||||
// 'slug' => 'Slug',
|
||||
// 'status' => 'Статус',
|
||||
// ]
|
||||
|
||||
return [
|
||||
'gestalt_profile_id' => 'Профиль',
|
||||
'entity' => 'Сущность',
|
||||
'entity_id' => 'ID сущности',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public static function getStatus(): array
|
||||
{
|
||||
return [
|
||||
self::DISABLE_STATUS => "Не активный",
|
||||
self::ACTIVE_STATUS => "Активный",
|
||||
];
|
||||
}
|
||||
|
||||
public function profile(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Gestalt_profile::class, 'gestalt_profile_id');
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user