深圳全飞鸿

标题: 关于fastadmin的快速搜索框 [打印本页]

作者: syant    时间: 2025-4-8 14:07
标题: 关于fastadmin的快速搜索框
本帖最后由 syant 于 2025-4-8 16:54 编辑

class Admin extends Backend
{

    /**
     * @var \app\admin\model\Admin
     */
    protected $model = null;
    protected $selectpageFields = 'id,username,nickname,avatar';
    protected $searchFields = 'id,username,nickname';
    protected $childrenGroupIds = [];
    protected $childrenAdminIds = [];



代码位置:common\controler\Backend.php
protected function buildparams($searchfields = null, $relationSearch = null)

  1. if ($search) {
  2.             $searcharr = is_array($searchfields) ? $searchfields : explode(',', $searchfields);
  3.             foreach ($searcharr as $k => &$v) {
  4.                 $v = stripos($v, ".") === false ? $aliasName . $v : $v;
  5.             }
  6.             unset($v);
  7.             $where[] = [implode("|", $searcharr), "LIKE", "%{$search}%"];
  8.         }
复制代码




作者: syant    时间: 2025-4-8 14:15
Controler有四个常用属性
    protected $model = null;
       
        protected $noNeedLogin = ['lang'];
    protected $noNeedRight = ['*'];
        protected $selectpageFields = 'model_name,rule';
        protected $searchFields = 'model_name,rule';


作者: syant    时间: 2025-4-8 16:42
本帖最后由 syant 于 2025-4-8 16:53 编辑

    {field: 'id', title: 'ID', operate:false,},

用于控制查询的





欢迎光临 深圳全飞鸿 (http://www.nagomes.com/disc/) Powered by Discuz! X3.2