ArticleShow.php 2.3 KB
<?php
/**
+-----------------------------------------------------------------------------------------------------------------------
 * 管理端详情show trait层:渲染生成 Article 详情
+-----------------------------------------------------------------------------------------------------------------------
 *
 * PHP version 7
 *
 * @category  App\Admin\Shows
 * @package   App\Admin\Shows
 * @author    Richer <yangzi1028@163.com>
 * @date      2023年2月21日10:04:39
 * @copyright 2020-2022 Richer (http://www.Richer.com/)
 * @license   http://www.Richer.com/ License
 * @link      http://www.Richer.com/
 */
namespace App\Admin\Shows;

/**
 * Trait ArticleShow
 * @package App\Admin\Shows
 */
trait ArticleShow
{
    /**
     * 为详情show渲染字段
     *
     * @return void
     */
    protected function renderShowFields()
    {
        $this->showTextField('id', __('ID'));
        $this->showTextField('section.title', __('section'));
        $this->showTextField('description');
        $this->showSingleImageField();
        $this->showMultipleImageField();
        $this->showRichTextField();
        $this->showTextField('status_color_show', __('status'));
        $this->showTextField('created_at', __('created_at'));
        $this->showTextField('updated_at', __('updated_at'));
        $this->show->divider();
        $this->show->auditRecords('审核记录明细')->as(function ($records) {
            $html = '<div class="track-list track-list-date"><ul>';
            $records->each(function ($record, $index) use (&$html) {
                if ($index === 0) {
                    $html .= '<li class="afterdate  node-to-change track-node-0008  first">';
                } else {
                    $html .= '<li class="">';
                }
                $html .= '<i class="node-icon"><i class="dot"></i><i class="state-icon"></i></i>';
                $html .= ' <span class="date">' .$record->created_at . '</span>';
                $html .= ' <span class="auditor">' .optional($record->user)->name . '</span>';
                $html .= ' <span class="status">' .$record->audited_status_show_color . '</span>';
                $html .= ' <span class="txt">' .$record->audited_opinion . '</span>';
            });
            return $html;
        })->setGroupClass('col-sm-12 clear-both')
            ->setWidth(11, 1);
    }
}