| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- <?php
- namespace App\Module\Friend\AdminControllers\Helper;
- use Dcat\Admin\Show;
- use Dcat\Admin\Show\Field;
- /**
- * 详情助手类
- *
- * 用于辅助构建后台详情页
- */
- class ShowHelper
- {
- /**
- * Show 实例
- *
- * @var Show
- */
- protected $show;
- /**
- * 构造函数
- *
- * @param Show $show
- */
- public function __construct(Show $show)
- {
- $this->show = $show;
- }
- /**
- * 创建实例
- *
- * @param Show $show
- * @return static
- */
- public static function make(Show $show)
- {
- return new static($show);
- }
- /**
- * 添加字段
- *
- * @param string $name
- * @param string $label
- * @return Field
- */
- public function field(string $name, string $label): Field
- {
- return $this->show->field($name, $label);
- }
- /**
- * 添加分隔线
- *
- * @param string $title
- * @return Show
- */
- public function divider(string $title = ''): Show
- {
- return $this->show->divider($title);
- }
- /**
- * 添加行
- *
- * @param callable $callback
- * @return Show
- */
- public function row(callable $callback): Show
- {
- return $this->show->row($callback);
- }
- /**
- * 添加卡片
- *
- * @param string $title
- * @param callable $callback
- * @return Show
- */
- public function card(string $title, callable $callback): Show
- {
- return $this->show->card($title, $callback);
- }
- /**
- * 添加面板
- *
- * @param string $title
- * @param callable $callback
- * @return Show
- */
- public function panel(string $title, callable $callback): Show
- {
- return $this->show->panel($title, $callback);
- }
- /**
- * 添加工具
- *
- * @param callable $callback
- * @return Show
- */
- public function tools(callable $callback): Show
- {
- return $this->show->tools($callback);
- }
- /**
- * 添加关联
- *
- * @param string $name
- * @param string $label
- * @param callable $callback
- * @return Show
- */
- public function relation(string $name, string $label, callable $callback): Show
- {
- return $this->show->relation($name, $label, $callback);
- }
- }
|