mirror of
https://github.com/BookStackApp/BookStack.git
synced 2026-02-28 11:19:38 +03:00
27 lines
583 B
PHP
27 lines
583 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace BookStack\Entities\Models;
|
||
|
|
|
||
|
|
use BookStack\Entities\Tools\EntityHtmlDescription;
|
||
|
|
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @mixin Entity
|
||
|
|
*/
|
||
|
|
trait ContainerTrait
|
||
|
|
{
|
||
|
|
public function descriptionInfo(): EntityHtmlDescription
|
||
|
|
{
|
||
|
|
return new EntityHtmlDescription($this);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @return HasOne<EntityContainerData, $this>
|
||
|
|
*/
|
||
|
|
public function relatedData(): HasOne
|
||
|
|
{
|
||
|
|
return $this->hasOne(EntityContainerData::class, 'entity_id', 'id')
|
||
|
|
->where('entity_type', '=', $this->getMorphClass());
|
||
|
|
}
|
||
|
|
}
|