<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                # 列表過濾器 ### [](https://octobercms.com/docs/backend/lists#list-filters)使用列表過濾器 可以通過在列表配置中[添加過濾器定義](https://octobercms.com/docs/backend/lists#adding-filters)來[過濾](https://octobercms.com/docs/backend/lists#adding-filters)列表。同樣,篩選器由它們自己的包含篩選器作用域的配置文件驅動,每個作用域都是一個可以過濾列表的方面。下一個示例顯示了過濾器定義文件的典型內容。 ~~~ # =================================== # Filter Scope Definitions # =================================== scopes: category: label: Category modelClass: Acme\Blog\Models\Category conditions: category_id in (:filtered) nameFrom: name status: label: Status type: group conditions: status in (:filtered) options: pending: Pending active: Active closed: Closed published: label: Hide published type: checkbox default: 1 conditions: is_published <> true approved: label: Approved type: switch default: 2 conditions: - is_approved <> true - is_approved = true created_at: label: Date type: date conditions: created_at >= ':filtered' published_at: label: Date type: daterange conditions: created_at >= ':after' AND created_at <= ':before' ~~~ ### [](https://octobercms.com/docs/backend/lists#filter-scope-options)范圍選項 您可以為每個范圍指定以下選項(如果適用): | 選項 | 描述 | | --- | --- | | **label** | 向用戶顯示過濾器范圍時的名稱。 | | **type** | 定義應如何呈現此范圍(請參見下面的[范圍類型](https://octobercms.com/docs/backend/lists#scope-types))。默認值:組。 | | **conditions** | 指定要應用于列表模型查詢的原始where語句,該`:filtered`參數表示過濾后的值。 | | **scope** | 指定在**列表模型中**定義的[查詢范圍方法](https://octobercms.com/docs/database/model#query-scopes),以應用于列表查詢。第一個參數將包含查詢對象(按照常規范圍方法),第二個參數將包含過濾后的值 | | **options** | 如果按多個項目過濾時使用的選項,則此選項可以在`modelClass`模型中指定數組或方法名稱。 | | **nameFrom** | 如果按多個項目過濾,則顯示名稱的屬性,該屬性取自`modelClass`模型的所有記錄。 | | **default** | 可以是整數(開關,復選框,數字)或數組(組,日期范圍,數字范圍)或字符串(日期)。 | | **permissions** | 當前后端用戶必須具有的權限才能使用過濾器作用域。支持單個權限的字符串或僅需要一個權限即可授予訪問權限的一組權限。 | | **dependsOn** | 此作用域[依賴](https://octobercms.com/docs/backend/lists#filter-scope-dependencies)的字符串或其他作用域名稱的數組。修改其他范圍后,此范圍將更新。 | ### 篩選器依存關系 篩選器作用域可以通過定義`dependsOn`[scope選項](https://octobercms.com/docs/backend/lists#filter-scope-options)來聲明對其他作用域的依賴關系,該[選項](https://octobercms.com/docs/backend/lists#filter-scope-options)提供了一種服務器端解決方案,用于在修改其依賴關系時更新作用域。當聲明為依賴項的范圍發生更改時,定義范圍將動態更新。這為更改提供給示波器的可用選項提供了機會。 ~~~ country: label: Country type: group conditions: country_id in (:filtered) modelClass: October\Test\Models\Location options: getCountryOptions city: label: City type: group conditions: city_id in (:filtered) modelClass: October\Test\Models\Location options: getCityOptions dependsOn: country ~~~ 在上面的示例中,范圍更改后,`city`范圍將刷新`country`。定義`dependsOn`屬性的任何作用域都將作為“作用域名稱”鍵控的數組傳遞給“過濾器”小部件的所有當前作用域對象,包括它們的當前值。 ~~~ public function getCountryOptions() { return Country::lists('name', 'id'); } public function getCityOptions($scopes = null) { if (!empty($scopes['country']->value)) { return City::whereIn('country_id', array_keys($scopes['country']->value))->lists('name', 'id'); } else { return City::lists('name', 'id'); } } ~~~ > **注意:**`type: group`僅在此階段支持范圍依賴項。 ### [](https://octobercms.com/docs/backend/lists#scope-types)可用范圍類型 這些類型可用于確定應如何顯示過濾器范圍。 * [組](https://octobercms.com/docs/backend/lists#filter-group) * [復選框](https://octobercms.com/docs/backend/lists#filter-checkbox) * [開關](https://octobercms.com/docs/backend/lists#filter-switch) * [日期](https://octobercms.com/docs/backend/lists#filter-date) * [日期范圍](https://octobercms.com/docs/backend/lists#filter-daterange) * [數](https://octobercms.com/docs/backend/lists#filter-number) * [號碼范圍](https://octobercms.com/docs/backend/lists#filter-numberrange) * [文本](https://octobercms.com/docs/backend/lists#filter-text) ### [](https://octobercms.com/docs/backend/lists#filter-group)組 `group`\-按一組項目過濾列表,通常按相關模型進行過濾,并且需要`nameFrom`或`options`定義。例如:狀態名稱為打開,關閉等。 ~~~ status: label: Status type: group conditions: status in (:filtered) default: pending: Pending active: Active options: pending: Pending active: Active closed: Closed ~~~ ### [](https://octobercms.com/docs/backend/lists#filter-checkbox)復選框 `checkbox`\-用作二進制復選框以將預定義條件或查詢應用于列表(打開或關閉)。使用0代表關閉,使用1代表開啟 ~~~ published: label: Hide published type: checkbox default: 1 conditions: is_published <> true ~~~ ### [](https://octobercms.com/docs/backend/lists#filter-switch)開關 `switch`\-用作在兩個預定義條件或對列表的查詢(不確定,打開或關閉)之間切換的開關。使用0表示關閉,使用1表示不確定,使用2表示打開作為默認值 ~~~ approved: label: Approved type: switch default: 1 conditions: - is_approved <> true - is_approved = true ~~~ ### [](https://octobercms.com/docs/backend/lists#filter-date)日期 `date`\-顯示要選擇的單個日期的日期選擇器。條件屬性中可用的值是: * `:filtered`:所選日期的格式為`Y-m-d` * `:before`:選定的日期格式為`Y-m-d 00:00:00`,從后端時區轉換為應用程序時區 * `:after`:選定的日期格式為`Y-m-d 23:59:59`,從后端時區轉換為應用程序時區 created\_at:標簽:日期類型:date最小日期:'2001-01-23'maxDate:'2030-10-13'yearRange:10條件:created\_at> =':filtered' ### [](https://octobercms.com/docs/backend/lists#filter-daterange)日期范圍 `daterange`\-顯示將兩個日期選擇為日期范圍的日期選擇器。條件屬性中可用的值是: * `:before`:所選的“之前”日期格式為`Y-m-d H:i:s` * `:beforeDate`:所選的“之前”日期格式為`Y-m-d` * `:after`:所選的“之后”日期格式為`Y-m-d H:i:s` * `:afterDate`:所選的“之后”日期格式為`Y-m-d` Published\_at:標簽:日期類型:daterange最小日期:'2001-01-23'maxDate:'2030-10-13'yearRange:10條件:created\_at> =':after'AND created\_at <=':before' 為日期和日期范圍使用默認值 ~~~php myController::extendListFilterScopes(function($filter) { 'Date Test' => [ 'label' => 'Date Test', 'type' => 'daterange', 'default' => $this->myDefaultTime(), 'conditions' => "created_at >= ':after' AND created_at <= ':before'" ], ]); }); // return value must be instance of carbon public function myDefaultTime() { return [ 0 => Carbon::parse('2012-02-02'), 1 => Carbon::parse('2012-04-02'), ]; } ~~~ 您可能還希望進行設置,`ignoreTimezone: true`以防止在顯示的日期和數據庫中存儲的日期之間進行時區轉換,因為默認情況下,后端時區首選項應用于顯示值。 ~~~ published_at: label: Date type: daterange minDate: '2001-01-23' maxDate: '2030-10-13' yearRange: 10 conditions: created_at >= ':after' AND created_at <= ':before' ignoreTimezone: true ~~~ > **注意:**該`ignoreTimezone`選項也適用于`date`過濾器類型。 ### [](https://octobercms.com/docs/backend/lists#filter-number)數 `number`\-顯示輸入的單個號碼。該值可在條件屬性中用作`:filtered`。 ~~~ age: label: Age type: number default: 14 conditions: age >= ':filtered' ~~~ ### [](https://octobercms.com/docs/backend/lists#filter-numberrange)編號范圍 `numberrange`\-顯示兩個要輸入為數字范圍的數字的輸入。條件屬性中可用的值是: * `:min`:最小值,默認為-2147483647 * `:max`:最大值,默認為2147483647 您可以將最小值留為空白以搜索所有最大值為止的內容,反之亦然,可以將最大值留為空白以搜索至少最小值的所有內容。 ~~~ visitors: label: Visitor Count type: numberrange default: 0: 10 1: 20 conditions: visitors >= ':min' and visitors <= ':max' ~~~ ### [](https://octobercms.com/docs/backend/lists#filter-text)文本 `text`\-顯示要輸入的字符串的文本輸入。您可以指定`size`將在輸入大小屬性中注入的屬性(默認值:10)。 ~~~ username: label: Username type: text conditions: username = :value size: 2 ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看