コード例 #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Inventorystock::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'brand_id' => $this->brand_id, 'watches_id' => $this->watches_id, 'quantity' => $this->quantity]);
     return $dataProvider;
 }
コード例 #2
0
ファイル: Watches.php プロジェクト: niranjan1990/izone
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getInventorystocks()
 {
     return $this->hasMany(Inventorystock::className(), ['watches_id' => 'id']);
 }
コード例 #3
0
ファイル: SiteController.php プロジェクト: niranjan1990/izone
 public function actionInventory()
 {
     $model = new Inventorystock();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->refresh();
     } else {
         return $this->render('inventory', ['model' => $model]);
     }
 }
コード例 #4
0
 /**
  * Finds the Inventorystock model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Inventorystock the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Inventorystock::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }