This feature is used to extend the detail field display. This can be implemented using the built-in display method that does not meet the requirements.
First define the extension class:
<?phpnamespaceApp\Admin\Extensions\Show;useEzadev\Admin\Show\AbstractField;classUnSerializeextendsAbstractField{publicfunctionrender($arg ='') {// return any content that can be renderedreturnunserialize($this->value); }}
Then register the extension class in app/Admin/bootstrap.php
The arguments passed to the unserialize() method are passed to the UnSerialize::render() method in order.
You can see several common properties in the parent class Ezadev\Admin\Show\AbstractField.
Where $value and $model are the current field values and the current data model, which can be used to get the data you want in the render() method.
$border is used to control whether the current display content requires an outer border, and $escape is used to set the current display content to be HTML-escaped.
/**
* Field value.
*
* @var mixed
*/
protected $value;
/**
* Current field model.
*
* @var Model
*/
protected $model;
/**
* If this field show with a border.
*
* @var bool
*/
public $border = true;
/**
* If this field show escaped contents.
*
* @var bool
*/
public $escape = true;