• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP models\Student类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: postStudentModal

 function postStudentModal(Request $request, Student $student)
 {
     $student->user->email = $request->get('email');
     $student->user->save();
     $student->programme = $request->get('programme');
     $student->active = $request->get('active');
     $student->group_id = $request->get('group_id') ?: null;
     $student->remark = $request->get('remark');
     $student->save();
 }
开发者ID:robindv,项目名称:WebDB,代码行数:10,代码来源:StaffController.php


示例2: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(StudentRequest $request)
 {
     $data = $request->all();
     $student = new Student();
     $student->fromArray($data);
     $student->save();
     flash()->success("ADDED");
     session(['attribute' => \Lang::get('general.STUDENT')]);
     return redirect($this->main_page);
 }
开发者ID:nstojanovickg,项目名称:diplomski,代码行数:15,代码来源:StudentController.php


示例3: saveUser

 /**
  * @param $name
  * @param $email
  * @param $request
  * @param $workshop
  */
 private function saveUser($name, $email, $request, $workshop)
 {
     $user = new Student();
     if (!Student::isStudent($name, $email)) {
         $user->fill($request);
         $user->status = 'C';
         $user->profile = $this->getUserProfileString($request);
         $user->save();
     } else {
         $user = $user->getByEmailAndName($name, $email);
     }
     if (!$user->isRegistered($name, $email, $workshop->id)) {
         $user->workshops()->attach($workshop->id, ['sign_date' => date('Y-m-d H:i:s')]);
     }
 }
开发者ID:kevinslondon,项目名称:Yogaground,代码行数:21,代码来源:WorkshopListener.php


示例4: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     User::truncate();
     Staff::truncate();
     Student::truncate();
     StudentNumber::truncate();
     StaffNumber::truncate();
     $user = ['first_name' => 'Jose Antonio', 'last_name' => 'Sinadinse', 'fullname' => '', 'password' => \Hash::make('password'), 'email' => '[email protected]', 'address' => 'Pretoria', 'cellnumber' => '000000000', 'user_type_id' => 1, 'state_id' => 1];
     if (StaffNumber::all()->count() == 0) {
         $stfnum = StaffNumber::create(["number" => 2000, "date" => date("Y-m-d")]);
     } else {
         $lateststfnum = StaffNumber::all()->last();
         $stfnum = StaffNumber::create(["number" => $lateststfnum->number + 1, "date" => date("Y-m-d")]);
     }
     $staff = Staff::create(['staff_number' => $stfnum->number]);
     $user = $staff->user()->create($user);
     $user->addPermission('admin');
     for ($i = 3; $i < 20; $i++) {
         $user = ['first_name' => 'Name' . $i, 'last_name' => 'Surname' . $i, 'fullname' => '', 'password' => \Hash::make('aleluia'), 'email' => 'josebarros' . $i . '@hotmail.com', 'address' => 'Pretoria', 'cellnumber' => '00000000' . $i, 'user_type_id' => 3, 'state_id' => 1];
         if (StudentNumber::all()->count() == 0) {
             $stdnum = StudentNumber::create(["number" => 200000000, "date" => date("Y-m-d")]);
         } else {
             $lateststdnum = StudentNumber::all()->last();
             $stdnum = StudentNumber::create(["number" => $lateststdnum->number + 1, "date" => date("Y-m-d")]);
         }
         $student = Student::create(['student_number' => $stdnum->number, "university_id" => 1, "faculty_id" => '', "department_id" => '', "course_id" => '']);
         $user = $student->user()->create($user);
         $user->addPermission('student');
     }
 }
开发者ID:joaonzangoII,项目名称:find_my_campuses_friend,代码行数:35,代码来源:DatabaseSeeder.php


示例5: 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


示例6: run

 public function run()
 {
     DB::table('students')->delete();
     Student::create(['student_id' => 'M21132111002', 'batch' => '25', 'department' => 'CSE', 'user_id' => '2']);
     Student::create(['student_id' => 'M21132111009', 'batch' => '27', 'department' => 'BBA', 'user_id' => '3']);
     Student::create(['student_id' => 'M21132111003', 'batch' => '26', 'department' => 'English', 'user_id' => '4']);
 }
开发者ID:Kryptonitesoft,项目名称:quizapp,代码行数:7,代码来源:StudentTableSeeder.php


示例7: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(StudentsRequest $request)
 {
     $user = ['first_name' => $request->input('first_name'), 'last_name' => $request->input('last_name'), 'fullname' => '', 'password' => '0000', 'email' => $request->input('email'), 'address' => $request->input('address'), 'cellnumber' => $request->input('cellnumber'), 'user_type_id' => $request->input('user_type_id'), 'state_id' => 1];
     $student = Student::create(['student_number' => '00000']);
     $user = $student->user()->create($user);
     $user->makeEmployee('student');
     return redirect("/students");
 }
开发者ID:joaonzangoII,项目名称:find_my_campuses_friend,代码行数:13,代码来源:StudentsController.php


示例8: getHome

 public function getHome()
 {
     // $students = Student::getStudents();
     $students = Student::getStudentsCheckedIn();
     $notices = Notice::getNotices();
     // print_r($notices);
     return view('home', ["students" => $students], ["notices" => $notices]);
 }
开发者ID:chris346,项目名称:laravel-project,代码行数:8,代码来源:homeController.php


示例9: 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


示例10: fire

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     foreach (Student::all() as $student) {
         $picture = file_get_contents('http://local-sig.utt.fr/Pub/trombi/individu/' . $student->student_id . '.jpg');
         file_put_contents(public_path() . '/uploads/students-trombi/' . $student->student_id . '.jpg', $picture);
     }
     $this->info('Done!');
 }
开发者ID:ungdev,项目名称:integration-UTT,代码行数:13,代码来源:ImportStudentPictures.php


示例11: create

 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create()
 {
     $users_list = Student::lists("student_number", "id");
     if (Auth::user()->isStudent()) {
         $users_list = [Auth::user()->id => Auth::user()->student->student_number];
     }
     $companies_list = Company::lists("name", "id");
     return view("pages.sos_requests.create", compact("users_list", "companies_list"));
 }
开发者ID:joaonzangoII,项目名称:find_my_campuses_friend,代码行数:14,代码来源:SosRequestController.php


示例12: actionRegistration

 public function actionRegistration($role = '')
 {
     if (!\Yii::$app->user->isGuest) {
         $this->redirect(\Yii::$app->user->getReturnUrl());
     }
     if ($role == '') {
         return $this->render('registration');
     }
     $model = new User();
     $role_model = new Company();
     $model->role = User::ROLE_COMPANY;
     if ($role != 'company') {
         //Student registration
         $role = 'student';
         $role_model = new Student();
         $model->role = User::ROLE_STUDENT;
     }
     if ($model->load(Yii::$app->request->post()) && $role_model->load(Yii::$app->request->post()) && $model->register()) {
         if ($role == 'student') {
             $role_model->idUser = $model->id;
             if ($role_model->save()) {
                 return $this->render('registration_student_success', ['model' => $model]);
             }
         } else {
             $role_model->idUser = $model->id;
             //Upload logo
             if (isset($_FILES['Company']) && $_FILES['Company']['name']['logo_path'] != "") {
                 if (!in_array($_FILES['Company']['type']['logo_path'], $this->image_array)) {
                     $role_model->addError('logo_path', 'Доступные расширения для файла: jpg, gif, png.');
                 } else {
                     $rnd = rand(0, 9999);
                     $uploadedFile = UploadedFile::getInstance($role_model, 'logo_path');
                     $fileName = 'files/' . $rnd . '_' . $uploadedFile->name;
                     $role_model->logo_path = $fileName;
                     $uploadedFile->saveAs($fileName);
                 }
             }
             if ($role_model->save()) {
                 return $this->render('registration_company_success', ['model' => $model]);
             }
         }
     }
     return $this->render('registration_' . $role, ['model' => $model, 'role_model' => $role_model]);
 }
开发者ID:Sywooch,项目名称:RabotaNURE,代码行数:44,代码来源:SiteController.php


示例13: 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


示例14: generateStudents

 /**
  *
  */
 private function generateStudents()
 {
     $levels = array(Student::LEVEL_A1, Student::LEVEL_A2, Student::LEVEL_B1, Student::LEVEL_B2, Student::LEVEL_C1, Student::LEVEL_C2);
     $oldestMktime = mktime(0, 0, 0, 0, 0, date('Y') - $this->getConfig('student_max_age'));
     $newestMktime = mktime(0, 0, 0, 0, 0, date('Y') - $this->getConfig('student_min_age'));
     $prepareItemData = function ($itemNum) use($oldestMktime, $newestMktime, $levels) {
         return ['Student Name ' . $itemNum, "test{$itemNum}@email.com", date('Y-m-d', rand($oldestMktime, $newestMktime)), $levels[rand(0, count($levels) - 1)]];
     };
     $this->loadByPortion($prepareItemData, Student::tableName(), ['name', 'email', 'birthday', 'level'], $this->getConfig('students_num'));
 }
开发者ID:Olga--Trushina,项目名称:teachers,代码行数:13,代码来源:FillController.php


示例15: actionFilter2

 public function actionFilter2()
 {
     $teachers = [];
     $students = [];
     $teachers = Teacher::findBySql("\n            select t.name, t.id from (\n                select st2.teacher_id st2, st3.teacher_id st3, count(st3.student_id) cnt from teacher_student st2\n                    left join teacher_student st3 on st3.student_id = st2.student_id and st2.teacher_id != st3.teacher_id\n                    where st3.teacher_id is not null group by st3.teacher_id, st2.teacher_id\n                    ) res \n                    left join teacher t on t.id=st2\n                    left join teacher t2 on t2.id=st3\n                    order by cnt DESC limit 2\n        ")->all();
     if (count($teachers) == 2) {
         $students = Student::findBySql("\n                select * from teacher_student st\n                left join student t on t.id = st.student_id \n                left join teacher_student st2 on st2.teacher_id = :teacher1 and st2.student_id = st.student_id\n                where st.teacher_id = :teacher2 and st2.teacher_id is not null\n            ", [':teacher1' => $teachers[0]->id, ':teacher2' => $teachers[1]->id])->all();
     }
     return $this->render('filter2', ['teachers' => $teachers, 'students' => $students]);
 }
开发者ID:ustkirill,项目名称:testwork,代码行数:10,代码来源:TeacherController.php


示例16: 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


示例17: __construct

 public function __construct()
 {
     $this->middleware('auth');
     $user_types = UserType::lists("name", "id");
     $states = State::lists("name", "id");
     $users_count = User::with("state")->latest()->get()->count();
     $universities_count = University::latest()->get()->count();
     $sos_count = SosModel::latest()->get()->count();
     $students_count = Student::latest()->get()->count();
     $companies_count = Company::latest()->get()->count();
     \View::share(compact("users_count", "universities_count", "sos_count", "states", "user_types", "students_count", "companies_count"));
 }
开发者ID:joaonzangoII,项目名称:find_my_campuses_friend,代码行数:12,代码来源:UniversitiesController.php


示例18: 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


示例19: 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


示例20: 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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP models\Tag类代码示例发布时间:2022-05-23
下一篇:
PHP models\Setting类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap