PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.5.4
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.5.4
1.6.5 1.6.4 1.6.3 1.6.2 1.6.1 1.6.0 1.5.4 1.5.5 1.5.3 1.5.2 1.5.1 1.5.0 1.4.2 1.4.1 1.4.0 1.3.28 1.3.27 1.3.26 1.3.25 1.3.23 1.3.22 1.3.21 1.3.20 1.3.19 trunk All 48 releases
fluent-cart / app / Services / Filter / LabelFilter.php

LabelFilter.php in FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler 1.5.4, at app/Services/Filter/LabelFilter.php

76 lines 2.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentCart\App\Services\Filter;
4
5 use FluentCart\App\Models\Label;
6 use FluentCart\App\Models\Order;
7 use FluentCart\Framework\Database\Orm\Builder;
8 use FluentCart\Framework\Support\Arr;
9
10 class LabelFilter extends BaseFilter
11 {
12
13 public function applySimpleFilter(?string $search = null): void
14 {
15 $this->query = $this->query->when($search ?? $this->search, function ($query, $search) {
16 return $query->where('value', 'LIKE', "%{$search}%");
17 });
18 }
19
20 public function tabsMap(): array
21 {
22 return [];
23 }
24
25 public function getModel(): string
26 {
27 return Label::class;
28 }
29
30 public static function getFilterName(): string
31 {
32 return 'label';
33 }
34
35
36 public function applyActiveViewFilter(?string $activeView = null): void
37 {
38
39 }
40
41 public static function getSelectFilterOptions(array $args): array
42 {
43 return static::make($args)->get()->pluck('value', 'id')->toArray();
44 }
45
46 public static function advanceFilterOptions()
47 {
48 return null;
49 }
50
51 public static function advanceFilterOptionsForOther($otherFilters = []): array
52 {
53 return array_merge(
54 $otherFilters,
55 [
56 'labels' => [
57 'label' => __('Labels', 'fluent-cart'),
58 'value' => 'labels',
59 'children' => [
60 [
61 'label' => __('Label Name', 'fluent-cart'),
62 'value' => 'customer_email',
63 'type' => 'selections',
64 'filter_type' => 'relation',
65 'column' => 'label_id',
66 'relation' => 'labels',
67 'remote' => true,
68 'remote_data_key' => 'labels',
69 'is_multiple' => true
70 ]
71 ]
72 ]
73 ]
74 );
75 }
76 }