/**
  * Creates a new Physic model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionPhysic()
 {
     $subModelPhy = new Physic();
     if ($subModelPhy->load(Yii::$app->request->post()) && $subModelPhy->save()) {
         return $this->actionIndex();
     } else {
         return $this->render('../physic/create', ['model' => $subModelPhy]);
     }
 }
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Physic::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, 'large' => $this->large, 'tall' => $this->tall, 'width' => $this->width, 'maxWeight' => $this->maxWeight]);
     $query->andFilterWhere(['like', 'descript', $this->descript])->andFilterWhere(['like', 'longUnit', $this->longUnit])->andFilterWhere(['like', 'weightUnit', $this->weightUnit]);
     return $dataProvider;
 }
Example #3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPhysic0()
 {
     return $this->hasOne(Physic::className(), ['id' => 'physic']);
 }
 /**
  * Finds the Physic model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Physic the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Physic::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Example #5
0
 public function getAllPhy()
 {
     return Physic::find()->all();
 }