本文整理汇总了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');
}
示例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]);
}
}
示例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]);
}
示例4: deleteStudent
public function deleteStudent()
{
$stud_id = Input::get('stud_id');
$User = Student::find($stud_id);
if (!$User->delete()) {
return 0;
} else {
return 1;
}
}
示例5: deleteStudent
public function deleteStudent($id)
{
return Student::find($id)->delete();
// if($s){
// $s->delete();
// return true;
// }else{
// return false;
// }
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}
示例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();
}
}