コード例 #1
0
ファイル: Importer.php プロジェクト: sasik-github/system.pro
 /**
  * @param array $row
  */
 private function exportToDb($row)
 {
     if (isset($this->children[(int) $row[2]])) {
         return;
     }
     Child::create(['fio' => $row[0], 'card_number' => $row[2]]);
 }
コード例 #2
0
ファイル: ChildController.php プロジェクト: Sywooch/babydiary
 /**
  * Finds the Child model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Child the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Child::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
コード例 #3
0
ファイル: ChildTooth.php プロジェクト: Sywooch/babydiary
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getChild()
 {
     return $this->hasOne(Child::className(), ['child_id' => 'child_id']);
 }
コード例 #4
0
 private function exportToDb(array $row)
 {
     Child::create(['fio' => $row[0], 'card_number' => $row[2]]);
 }
コード例 #5
0
 /**
  * @param $cardNumber
  * @return Child
  */
 public function getChildByCardNumber($cardNumber)
 {
     return Child::where('card_number', $cardNumber)->first();
 }
コード例 #6
0
 private function createChild()
 {
     return \App\Models\Child::create(['fio' => 'Ребенок Иванова ' . rand(1, 10000), 'class' => rand(1, 11), 'class_char' => 'A', 'card_number' => rand(1000, 99999), 'city' => 'Кемерово', 'school_number' => rand(10, 100)]);
 }
コード例 #7
0
 public function postDelete($id)
 {
     $child = Child::findOrFail($id);
     $child->delete();
     return redirect()->action('ChildrenController@getIndex')->with('flash_message', 'Ребенок удален');
 }