PluginProbe
MailerLite – WooCommerce integration / 3.1.16
MailerLite – WooCommerce integration v3.1.16
3.1.27 3.1.25 3.1.26 3.1.24 3.1.23 3.1.22 3.1.21 3.1.20 3.1.19 3.1.18 3.1.17 3.1.16 3.1.15 1.8.7 1.8.8 2.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 All 148 releases
woo-mailerlite / includes / models / WooMailerLiteCategory.php

WooMailerLiteCategory.php in MailerLite – WooCommerce integration 3.1.16, at includes/models/WooMailerLiteCategory.php

56 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 class WooMailerLiteCategory extends WooMailerLiteModel
4 {
5 protected $casts = [
6 'resource_id',
7 'name',
8 'tracked'
9 ];
10
11 protected $isResource = true;
12
13 public static function tracked()
14 {
15 return static::builder()->setArgs([
16 'meta_query' => [
17 [
18 'key' => '_woo_ml_category_tracked',
19 'value' => true,
20 'compare' => '=',
21 ],
22 ],
23 ]);
24 }
25
26 public static function untracked()
27 {
28 return static::builder()->setArgs([
29 'meta_query' => [
30 'relation' => 'OR',
31 [
32 'key' => '_woo_ml_category_tracked',
33 'value' => ['1', 'true', 'yes'],
34 'compare' => 'NOT IN',
35 ],
36 [
37 'key' => '_woo_ml_category_tracked',
38 'compare' => 'NOT EXISTS',
39 ],
40 ],
41 'number' => -1
42 ]);
43 }
44
45 public static function getUntrackedCategoriesCount()
46 {
47 return self::untracked()->count();
48 }
49
50 public static function getTrackedCategoriesCount()
51 {
52 return self::tracked()->count();
53 }
54
55 }
56