<?php
 namespace App\Http\Controllers\Admin; use TechOnline\Laravel\Dao\ModelUtil; use TechSoft\Laravel\Admin\Cms\BasicCms; use TechSoft\Laravel\Admin\Cms\Field\FieldText; use TechSoft\Laravel\Admin\Support\AdminCheckController; class TopicController extends AdminCheckController { protected $cmsConfigBasic = [ 'model' => 'topic', 'pageTitle' => '专题管理', 'group' => 'data', 'canAdd' => false, 'canEdit' => false, 'canDelete' => true, 'fields' => [ 'title' => ['type' => FieldText::class, 'title' => '名称', 'list' => true, 'edit' => true, 'add' => true,], ] ]; public function dataPostAdd(&$data) { } public function dataPostEdit(&$data) { } public function dataPostDelete(&$data) { ModelUtil::delete('topic_note', ['topicId' => $data['id']]); ModelUtil::delete('topic_note_apply', ['topicId' => $data['id']]); ModelUtil::delete('topic_follower', ['topicId' => $data['id']]); } public function dataProcessView(&$item, &$record) { $item['title'] = '<a href="/t/' . $record['alias'] . '" target="_blank">' . $item['title'] . '</a>'; } public function dataList(BasicCms $basicCms) { return $basicCms->executeList($this, $this->cmsConfigBasic);; } public function dataDelete(BasicCms $basicCms) { return $basicCms->executeDelete($this, $this->cmsConfigBasic); } public function dataEdit(BasicCms $basicCms) { return $basicCms->executeEdit($this, $this->cmsConfigBasic); } public function dataAdd(BasicCms $basicCms) { return $basicCms->executeAdd($this, $this->cmsConfigBasic); } }