@@ 52-65 (lines=14) @@ | ||
49 | 'index' => [ |
|
50 | 'class' => IndexAction::class, |
|
51 | 'findOptions' => ['with_requests' => true, 'with_discounts' => true], |
|
52 | 'on beforePerform' => function (Event $event) { |
|
53 | /** @var \hipanel\actions\SearchAction $action */ |
|
54 | $action = $event->sender; |
|
55 | $dataProvider = $action->getDataProvider(); |
|
56 | $dataProvider->query->joinWith('ips'); |
|
57 | ||
58 | $dataProvider->query |
|
59 | ->andWhere(['with_ips' => 1]) |
|
60 | ->andWhere(['with_tariffs' => 1]) |
|
61 | ->andWhere(['with_switches' => 1]) |
|
62 | ->andWhere(['with_requests' => 1]) |
|
63 | ->andWhere(['with_discounts' => 1]) |
|
64 | ->select(['*']); |
|
65 | }, |
|
66 | 'filterStorageMap' => [ |
|
67 | 'name_like' => 'server.server.name', |
|
68 | 'ips' => 'hosting.ip.ip_in', |
|
@@ 79-94 (lines=16) @@ | ||
76 | ], |
|
77 | 'view' => [ |
|
78 | 'class' => ViewAction::class, |
|
79 | 'on beforePerform' => function (Event $event) { |
|
80 | /** @var \hipanel\actions\SearchAction $action */ |
|
81 | $action = $event->sender; |
|
82 | $dataProvider = $action->getDataProvider(); |
|
83 | $dataProvider->query->joinWith('uses'); |
|
84 | $dataProvider->query->joinWith('ips'); |
|
85 | ||
86 | // TODO: ipModule is not wise yet. Redo |
|
87 | $dataProvider->query |
|
88 | ->andWhere(['with_requests' => 1]) |
|
89 | ->andWhere(['show_deleted' => 1]) |
|
90 | ->andWhere(['with_discounts' => 1]) |
|
91 | ->andWhere(['with_uses' => 1]) |
|
92 | ->andWhere(['with_ips' => 1]) |
|
93 | ->select(['*']); |
|
94 | }, |
|
95 | 'data' => function ($action) { |
|
96 | /** |
|
97 | * @var Action $action |