with(['plugins'])->findOrEmpty(); } public static function all($params = []) { $where = []; foreach (['name', 'title'] as $v) { if (!empty($params[$v])) { $where[] = [$v, 'like', '%' . $params[$v] . '%']; } } return self::where($where)->order('weight', 'desc')->select(); } public function plugins() { return $this->hasMany(Plugin::class); } }