1 | <?php |
||
2 | /** |
||
3 | * Server module for HiPanel |
||
4 | * |
||
5 | * @link https://github.com/hiqdev/hipanel-module-server |
||
6 | * @package hipanel-module-server |
||
7 | * @license BSD-3-Clause |
||
8 | * @copyright Copyright (c) 2015-2019, HiQDev (http://hiqdev.com/) |
||
9 | */ |
||
10 | |||
11 | namespace hipanel\modules\server\models\query; |
||
12 | |||
13 | use hiqdev\hiart\ActiveQuery; |
||
14 | use Yii; |
||
15 | |||
16 | class ConfigQuery extends ActiveQuery |
||
17 | { |
||
18 | public function withPrices(): self |
||
19 | { |
||
20 | $this->joinWith('prices'); |
||
21 | $this->andWhere(['with_prices' => true]); |
||
22 | |||
23 | return $this; |
||
24 | } |
||
25 | |||
26 | public function getAvailable(): self |
||
27 | { |
||
28 | $this->addAction('get-available'); |
||
29 | |||
30 | return $this; |
||
31 | } |
||
32 | |||
33 | public function withSellerOptions(): self |
||
34 | { |
||
35 | $options = Yii::$app->user->isGuest ? ['seller' => Yii::$app->params['user.seller']] : [ |
||
36 | 'seller' => Yii::$app->user->identity->seller, |
||
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
37 | 'seller_id' => Yii::$app->user->identity->seller_id, |
||
0 ignored issues
–
show
|
|||
38 | ]; |
||
39 | $this->andWhere($options); |
||
40 | |||
41 | return $this; |
||
42 | } |
||
43 | } |
||
44 |