/** * @return string * @throws ForbiddenHttpException */ public function actionIndex() { if (User::isAdmin(Yii::$app->user->identity->username)) { $model = PaymentPlans::find()->where(['!=', 'name', 'Free'])->all(); return $this->render('index', compact('model')); } else { throw new ForbiddenHttpException('У вас нет прав администратора!', 404); } }
/** * @return string */ public function actionIndex() { $this->layout = 'home'; $subcat = new Subcategory(); $cat = Category::find()->all(); $basicModel = PaymentPlans::findOne(['name' => 'Basic']); $advancedModel = PaymentPlans::findOne(['name' => 'Advanced']); $proModel = PaymentPlans::findOne(['name' => 'Pro']); return $this->render('index', compact('cat', 'subcat', 'basic', 'advanced', 'pro', 'basicModel', 'advancedModel', 'proModel')); }
public function actionSet($id, $category_id) { if ($category_id == '2') { $basicModel = PaymentPlans::findOne(['name' => 'BasicElectronic']); $advancedModel = PaymentPlans::findOne(['name' => 'AdvancedElectronic']); $proModel = PaymentPlans::findOne(['name' => 'ProElectronic']); } else { if ($category_id == '3') { $basicModel = PaymentPlans::findOne(['name' => 'BasicTransport']); $advancedModel = PaymentPlans::findOne(['name' => 'AdvancedTransport']); $proModel = PaymentPlans::findOne(['name' => 'ProTransport']); } else { $basicModel = PaymentPlans::findOne(['name' => 'Basic']); $advancedModel = PaymentPlans::findOne(['name' => 'Advanced']); $proModel = PaymentPlans::findOne(['name' => 'Pro']); } } $liqpay = new LiqPay('i3673026691', '3fOw8EDMYgscpvSO8XkmIuAWmV5vkwBcE7FUV9h0'); $basic = $liqpay->cnb_form(['version' => '3', 'phone' => Yii::$app->user->identity->phone, 'amount' => $basicModel->price, 'currency' => 'UAH', 'description' => $basicModel->id, 'order_id' => Yii::$app->security->generateRandomString(), 'server_url' => 'http://sishik.net/plans/transaction/' . $id, 'result_url' => 'http://sishik.net/user/profile']); $advanced = $liqpay->cnb_form(['version' => '3', 'phone' => Yii::$app->user->identity->phone, 'amount' => $advancedModel->price, 'currency' => 'UAH', 'description' => $advancedModel->id, 'order_id' => Yii::$app->security->generateRandomString(), 'server_url' => 'http://sishik.net/plans/transaction/' . $id, 'result_url' => 'http://sishik.net/user/profile']); $pro = $liqpay->cnb_form(['version' => '3', 'phone' => Yii::$app->user->identity->phone, 'amount' => $proModel->price, 'currency' => 'UAH', 'description' => $proModel->id, 'order_id' => Yii::$app->security->generateRandomString(), 'server_url' => 'http://sishik.net/plans/transaction/' . $id, 'result_url' => 'http://sishik.net/user/profile']); return $this->render('set', compact('basic', 'advanced', 'pro', 'basicModel', 'advancedModel', 'proModel')); }
public function getPlan() { return $this->hasOne(PaymentPlans::className(), ['id' => 'plan_id']); }