dcat form和grid

 $form->editor('content')->required()->disk('oss')
                ->imageDirectory('/upload/pic/'.date('Y').date('m'))->placeholder('请输入内容')->height('600');
            $form->select('status')->options(\App\Models\ZzNews::$arr_status)
                ->when(\App\Models\ZzNews::VAlid_STATUS,function (Form $form){
                    $form->datetime('release_time')->rules('required_if:status,1') // 使用required_if
                    ->setLabelClass(['asterisk']); // 显示 * 号
                })

  

 $grid->column('content')->expand(function (Grid\Displayers\Expand $expand) {
                // 设置按钮名称
                $expand->button('新闻内容');
                // 返回显示的详情
                // 这里返回 content 字段内容,并用 Card 包裹起来
                $introduction = '<div style="text-align: left"><h5 class="text-bold">新闻内容</h5>' . htmlspecialchars_decode($this->content) .  '</div>';
                return new Card(null, $introduction);
            })->style('width:100px');

  

posted @ 2023-01-10 09:48  星云惊蛰  阅读(108)  评论(0)    收藏  举报