Model-show Fields

Insert a divider

If you want to add a divider between the fields:

$show->divider();

Modify the display

Modify the display content as follows

$show->title()->as(function ($title) {
    return "<{$title}>";
});

$show->contents()->as(function ($content) {
    return "<pre>{$content}</pre>";
});

Here are a few common display style methods implemented by the as method:

image

The content of the field avatar is the path or url of the image, which can be displayed as an image:

$show->avatar()->image();

The parameters of the image() method are referenced to Field::image()

file

The content of the field document is the path or url of the file, which can be displayed as an file:

$show->avatar()->file();

The parameters of the file() method are referenced to Field::file()

The content of the field homepage is a url link that can be displayed as an HTML link:

$show->homepage()->link();

The parameters of the link() method are referenced to Field::link()

label

Show the contents of the field tag as label:

$show->tag()->label();

The parameters of the label() method are referenced to Field::label()

badge

Show the contents of the field rate as badge:

$show->rate()->badge();

The parameters of the badge() method are referenced to Field::badge()

using

If the value of the field gender is f, m, it needs to be displayed with Female and Male respectively.

$show->gender()->using(['f' => 'Female', 'm' => 'Male']);