当前位置: 首页>>代码示例>>PHP>>正文


PHP Student::find方法代码示例

本文整理汇总了PHP中app\models\Student::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Student::find方法的具体用法?PHP Student::find怎么用?PHP Student::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\models\Student的用法示例。


在下文中一共展示了Student::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: postCapnhat

 function postCapnhat(Request $request, $id)
 {
     $model = Student::find($id);
     $model->first_name = $request->txtfirst_name;
     $model->middle_name = $request->txtmiddle_name;
     $model->last_name = $request->txtlast_name;
     $model->address = $request->txtaddress;
     $model->identity = $request->txtidentity;
     $model->phone = $request->txtphone;
     $model->birthday = $request->txtbirthday;
     $model->save();
     $img_current = $request->img_current;
     $file = $request->file('txtimage');
     if (!empty($file)) {
         $file_name = $model['id'] . "-" . time() . "-" . $file->getClientOriginalName();
         $model->image = $file_name;
         $file->move('../resources/upload/hocsinh/', $file_name);
         if (File::exists($img_current)) {
             File::delete($img_current);
         }
         $model->save();
     } else {
         echo "khong co file";
     }
     return redirect()->route('student');
 }
开发者ID:b0yblake1,项目名称:duan,代码行数:26,代码来源:StudentController.php

示例2: actionPreregister

 /**
  * @param $id
  * @return \yii\web\Response
  * @throws NotFoundHttpException
  * @throws \yii\db\Exception
  */
 public function actionPreregister($id)
 {
     $model = $this->findModel($id);
     $user = User::find()->where("id=" . Yii::$app->user->id)->one();
     $user_id = $user->id;
     $student = Student::find()->where("user_id=" . $user_id)->one();
     $student_id = $student->id;
     $vacancy = ProjectVacancy::find()->where("project_id=" . $id)->one();
     $vacancyValue = $vacancy->vacancy;
     if ($existe = StudentProfile::find()->where(['project_id' => $id, 'degree_id' => $student->degree_id])->one()) {
         if (Registration::find()->where(['student_id' => $student_id])->one()) {
             Yii::$app->getSession()->setFlash('danger', 'Ya te has pre-registrado a un proyecto');
             return $this->redirect(['view', 'id' => $model->id]);
         } else {
             if ($vacancyValue > 0) {
                 $newRegistration = new Registration();
                 $newRegistration->project_id = $id;
                 $newRegistration->student_id = $student_id;
                 $newRegistration->student_status = "preregistered";
                 $newRegistration->save();
                 Yii::$app->db->createCommand()->update('project_vacancy', ['vacancy' => $vacancy->vacancy - 1], 'project_id=' . $id)->execute();
                 Yii::$app->getSession()->setFlash('success', 'Te has pre-registrado al proyecto');
                 return $this->redirect(['view', 'id' => $model->id]);
             } else {
                 Yii::$app->getSession()->setFlash('danger', 'No hay cupo para este proyecto. Escoge otro.');
                 return $this->redirect(['view', 'id' => $model->id]);
             }
         }
     } else {
         Yii::$app->getSession()->setFlash('danger', 'No cuentas con el perfil solicitado');
         return $this->redirect(['view', 'id' => $model->id]);
     }
 }
开发者ID:RomarioLopezC,项目名称:RobotSS,代码行数:39,代码来源:ProjectController.php

示例3: actionView

 public function actionView($id = null)
 {
     if (!$id) {
         return $this->render('/site/error', ['name' => 'Bad request', 'message' => 'id is not defined']);
     }
     $dataProvider = Student::find()->where(['id' => (int) $id]);
     return $this->render('view', ['dataProvider' => $dataProvider]);
 }
开发者ID:ustkirill,项目名称:testwork,代码行数:8,代码来源:StudentController.php

示例4: deleteStudent

 public function deleteStudent()
 {
     $stud_id = Input::get('stud_id');
     $User = Student::find($stud_id);
     if (!$User->delete()) {
         return 0;
     } else {
         return 1;
     }
 }
开发者ID:jhunel2389,项目名称:hp-sis,代码行数:10,代码来源:StudentController.php

示例5: deleteStudent

 public function deleteStudent($id)
 {
     return Student::find($id)->delete();
     //        if($s){
     //            $s->delete();
     //            return true;
     //        }else{
     //            return false;
     //        }
 }
开发者ID:DiamondFL,项目名称:steedoffice_core_module,代码行数:10,代码来源:Student.php

示例6: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (Session::has('student_id') === false) {
         return Redirect::route('oauth.auth');
     }
     $student = Student::find(Session::get('student_id'));
     if ($student) {
         View::share('student', $student);
     }
     return $next($request);
 }
开发者ID:ungdev,项目名称:integration-UTT,代码行数:18,代码来源:OAuth.php

示例7: search

 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Student::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, 'user_id' => $this->user_id, 'faculty_id' => $this->faculty_id, 'current_semester' => $this->current_semester]);
     return $dataProvider;
 }
开发者ID:RomarioLopezC,项目名称:RobotSS,代码行数:20,代码来源:StudentSearch.php

示例8: search

 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = StudentModel::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, 'name' => $this->name]);
     return $dataProvider;
 }
开发者ID:Junaid-Farid,项目名称:olc,代码行数:20,代码来源:Student.php

示例9: search

 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Student::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, 'dob' => $this->dob]);
     $query->andFilterWhere(['like', 'studentNum', $this->studentNum])->andFilterWhere(['like', 'firstName', $this->firstName])->andFilterWhere(['like', 'surname', $this->surname])->andFilterWhere(['like', 'email', $this->email]);
     return $dataProvider;
 }
开发者ID:oma378501,项目名称:attendance,代码行数:21,代码来源:StudentSearch.php

示例10: search

 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Student::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(['st_id' => $this->st_id, 'st_active' => $this->st_active]);
     $query->andFilterWhere(['like', 'st_fname', $this->st_fname])->andFilterWhere(['like', 'st_lname', $this->st_lname])->andFilterWhere(['like', 'st_address', $this->st_address])->andFilterWhere(['like', 'st_postcode', $this->st_postcode])->andFilterWhere(['like', 'st_mobile', $this->st_mobile])->andFilterWhere(['like', 'st_phone', $this->st_phone])->andFilterWhere(['like', 'st_email', $this->st_email])->andFilterWhere(['like', 'st_disp_id', $this->st_disp_id]);
     return $dataProvider;
 }
开发者ID:AtaBashir,项目名称:ams,代码行数:21,代码来源:StudentSearch.php

示例11: search

 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Student::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, 'classid' => $this->classid, 'created_dt' => $this->created_dt]);
     $query->andFilterWhere(['like', 'course_id', $this->course_id])->andFilterWhere(['like', 'stucode', $this->stucode])->andFilterWhere(['like', 'fname', $this->fname])->andFilterWhere(['like', 'lname', $this->lname])->andFilterWhere(['like', 'faculity', $this->faculity])->andFilterWhere(['like', 'major', $this->major])->andFilterWhere(['like', 'address', $this->address])->andFilterWhere(['like', 'phone', $this->phone])->andFilterWhere(['like', 'score', $this->score])->andFilterWhere(['like', 'past', $this->past])->andFilterWhere(['like', 'status', $this->status]);
     return $dataProvider;
 }
开发者ID:kaweesak,项目名称:arit_training,代码行数:21,代码来源:StudentSearch.php

示例12: search

 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Student::find();
     $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 100], 'sort' => ['defaultOrder' => ['name' => SORT_ASC]]]);
     $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, 'birth_dt' => $this->birth_dt]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'level', $this->level]);
     return $dataProvider;
 }
开发者ID:proteye,项目名称:skyeng,代码行数:23,代码来源:StudentSearch.php

示例13: search

 public function search($params)
 {
     $query = Student::find()->joinWith('affiliations.handAnchor.day')->joinWith('affiliations.handAnchor.frequency')->joinWith('affiliations.school')->joinWith('phones')->joinWith('division')->joinWith('promotions.rank')->groupBy('student.id')->where(['affiliation.school_id' => user()->schoolId]);
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     // load the search form data and validate
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     // we only get here if there are filter params in the GET
     //dump($params);
     //dump('active=', $this->active);
     // adjust the query by adding the filters
     $query->andFilterWhere(['dob' => $this->dob, 'spar_auth' => $this->spar_auth, 'grapple_auth' => $this->grapple_auth, 'belt_size' => $this->belt_size, 'gi_size' => $this->gi_size]);
     $query->andFilterWhere(['student.active' => $this->active])->andFilterWhere(['like', 'prefix', $this->prefix])->andFilterWhere(['like', 'gender', $this->gender])->andFilterWhere(['like', 'fname', $this->fname])->andFilterWhere(['like', 'mname', $this->mname])->andFilterWhere(['like', 'lname', $this->lname])->andFilterWhere(['like', 'kai_number', $this->kai_number])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'notes', $this->notes])->andFilterWhere(['like', 'day.name', $this['handAnchor.name']])->andFilterWhere(['like', 'student_phone.number', $this->bestPhoneNumber])->andFilterWhere(['like', 'division.name', $this->division_id]);
     return $dataProvider;
 }
开发者ID:NewPaltzKarateAcademy,项目名称:KIMS,代码行数:16,代码来源:StudentSearch.php

示例14: updateProfil

 public function updateProfil(Request $request)
 {
     $input = $request->all();
     $validator = $this->profile_validator($input);
     if ($validator->fails()) {
         $this->throwValidationException($request, $validator);
     }
     $student = Student::find($input['Noreg']);
     $student->Noreg = $input['Noreg'];
     $student->Nama_Mhs = $input['Nama_Mhs'];
     $student->Prodi_id = $input['Prodi_id'];
     $student->Alamat = $input['Alamat'];
     $student->Telepon = $input['Telepon'];
     $student->Semester = $input['Semester'];
     $student->Mac = $input['Mac'];
     $student->save();
     return $this->profil();
 }
开发者ID:mekas,项目名称:absenv2,代码行数:18,代码来源:StudentController.php

示例15: actionIndex

 /**
  * Гененирует тестовый данные в БД. Единственная точка входа
  */
 public function actionIndex()
 {
     try {
         echo "Начинаю генерировать " . $this->getConfig('students_num') . " студентов" . "\n";
         $this->minStudentId = Student::find()->max('id') + 1;
         $this->generateStudents();
         $this->maxStudentId = Student::find()->max('id');
         echo 'Студенты успешно сгенерированы' . "\n";
         echo "Начинаю генерировать " . $this->getConfig('teachers_num') . " учителей" . "\n";
         $this->minTeacherId = Teacher::find()->max('id') + 1;
         $this->generateTeachers();
         $this->maxTeacherId = Teacher::find()->max('id');
         echo 'Учителя успешно сгенерированы' . "\n";
         echo "Начинаю генерировать привязки студентов к учителям." . "\n";
         $this->generateLinks();
         echo 'Привязки успешно сгенерированы' . "\n";
     } catch (Exception $e) {
         echo 'Ошибка. Не удалось сгенерировать тестовые данные. Причина: ' . $e->getMessage();
     }
 }
开发者ID:Olga--Trushina,项目名称:teachers,代码行数:23,代码来源:FillController.php


注:本文中的app\models\Student::find方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。