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


PHP Student::where方法代码示例

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


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

示例1: postRegister

 /**
  * Handle a registration request for the application.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function postRegister(Request $request)
 {
     $validator = $this->validator($request->all());
     $post = $request->all();
     $value = $post['regNo'];
     $determiner = Student::where('studentNo', $value)->pluck('studentNo');
     $determiner1 = Management::where('id', $value)->pluck('id');
     if ($validator->fails()) {
         $this->throwValidationException($request, $validator);
     } elseif ($determiner == null && $determiner1 == null) {
         return 'The registration number (' . $value . ') that you have entered does not exist in our database';
     }
     Auth::login($this->create($request->all()));
     return redirect($this->redirectPath());
 }
开发者ID:leloulight,项目名称:Clearance101,代码行数:21,代码来源:RegistersUsers.php

示例2: getCourseDetails

 /**
  * return courses of the given school
  * This Method is used in user Registration
  * @return Response
  */
 public function getCourseDetails(Request $request)
 {
     if (!isset($request->course_school_id)) {
         return;
     }
     $students = Student::where('course_school_id', $request->course_school_id)->orderBy('roll_no')->get();
     $count = $students->count();
     $users = [];
     foreach ($students as $key => $student) {
         array_push($users, $student->user);
     }
     $courseDetails = ['count' => $count, 'users' => $users, 'students' => $students];
     return $courseDetails;
     if (isset($course)) {
         return collect($course)->toJson();
     } else {
         return;
     }
 }
开发者ID:razikallayi,项目名称:peaceschools,代码行数:24,代码来源:CourseController.php

示例3: function

use App\Models\Team;
use App\Models\Student;
/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| Here you may define all of your model factories. Model factories give
| you a convenient way to create models for testing and seeding your
| database. Just tell the factory how a default model should look.
|
*/
$factory->define(App\Models\Newcomer::class, function (Faker\Generator $faker) {
    return ['first_name' => $faker->firstName, 'last_name' => $faker->lastName, 'sex' => $faker->boolean, 'birth' => $faker->date, 'branch' => $faker->randomElement(array('AII', 'ISI', 'MP', 'MTE', 'SI', 'SM', 'SRT', 'TC')), 'registration_email' => $faker->safeEmail, 'registration_cellphone' => '06.12.34.56.78', 'registration_phone' => '03.12.34.56.78', 'postal_code' => 10000, 'country' => $faker->randomElement(array('france', 'FRANCE', 'CAMEROUN')), 'ine' => '1000000000A', 'referral_id' => function () {
        $student = Student::where('referral_validated', 1)->orderByRaw("RAND()")->take(1)->get()->first();
        if ($student) {
            return $student->student_id;
        } else {
            return null;
        }
    }, 'team_id' => function () {
        $team = Team::where('validated', 1)->orderByRaw("RAND()")->take(1)->get()->first();
        if ($team) {
            return $team->id;
        } else {
            return null;
        }
    }, 'remember_token' => str_random(10)];
});
$factory->define(App\Models\Student::class, function (Faker\Generator $faker) {
开发者ID:ungdev,项目名称:integration-UTT,代码行数:30,代码来源:ModelFactory.php

示例4: handle

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     // Find email that are ready to be started
     $emails = Email::where('started', 0)->whereNotNull('scheduled_for')->where('scheduled_for', '<=', DB::RAW('NOW()'))->get();
     // set every email as started
     foreach ($emails as $email) {
         $email->started = 1;
         $email->save();
     }
     foreach ($emails as $email) {
         // Generate email list
         // To add more email list edit this file and `App/Models/Email.php
         $list = [];
         $students = [];
         $newcomers = [];
         switch ($email->list) {
             case Email::STUPRELISTE:
                 $list['stupre-liste@utt.fr'] = ['name' => 'STUPRE-liste', 'user' => null];
                 break;
             case Email::VOLUNTEERS:
                 $students = Student::where('volunteer', 1)->get();
                 break;
             case Email::CE_VALIDATED:
                 $students = Student::where('ce', 1)->whereNotNull('team_id')->where('team_accepted', 1)->get();
                 break;
             case Email::REFERRALS_VALIDATED:
                 $students = Student::where('referral', 1)->where('referral_validated', 1)->get();
                 break;
             case Email::REFERRALS_INCOMPLETE:
                 $students = Student::where('referral', 1)->where('referral_validated', 0)->where(function ($query) {
                     $query->where('phone', '')->orWhereNull('phone')->orWhere('email', '')->orWhereNull('email')->orWhere('referral_text', '')->orWhereNull('referral_text');
                 })->get();
                 break;
             case Email::REFERRALS_VALIDATED_BRANCH:
                 $students = Student::where('referral', 1)->where('referral_validated', 1)->where('branch', '<>', 'tc')->get();
                 break;
             case Email::REFERRALS_VALIDATED_TC:
                 $students = Student::where('referral', 1)->where('referral_validated', 1)->where('branch', '=', 'tc')->get();
                 break;
             case Email::ORGA:
                 $students = Student::where('orga', 1)->get();
                 break;
             case Email::ADMIN:
                 $students = Student::where('admin', 100)->get();
                 break;
             case Email::NEWCOMERS_ALL:
                 $newcomers = Newcomer::all();
                 break;
             case Email::NEWCOMERS_ALL_TC:
                 $newcomers = Newcomer::where('branch', 'TC')->get();
                 break;
             case Email::NEWCOMERS_ALL_BRANCH:
                 $newcomers = Newcomer::where('branch', '<>', 'TC')->where('branch', '<>', 'MP')->get();
                 break;
             case Email::NEWCOMERS_ALL_MASTER:
                 $newcomers = Newcomer::where('branch', 'MP')->get();
                 break;
             case Email::NEWCOMERS_FILLED:
                 $newcomers = Newcomer::where('email', '<>', '')->whereNotNull('email')->get();
                 break;
             case Email::NEWCOMERS_FILLED_TC:
                 $newcomers = Newcomer::where('branch', 'TC')->where('email', '<>', '')->whereNotNull('email')->get();
                 break;
             case Email::NEWCOMERS_FILLED_BRANCH:
                 $newcomers = Newcomer::where('branch', '<>', 'TC')->where('branch', '<>', 'MP')->where('email', '<>', '')->whereNotNull('email')->get();
                 break;
             case Email::NEWCOMERS_FILLED_MASTER:
                 $newcomers = Newcomer::where('branch', 'MP')->where('email', '<>', '')->whereNotNull('email')->get();
                 break;
             default:
                 echo 'Error : Unknown email list id';
                 break;
         }
         // Select email to put in the list
         foreach ($students as $student) {
             $list[$student->email] = ['name' => $student->first_name . ' ' . $student->last_name, 'user' => $student];
         }
         foreach ($newcomers as $newcomer) {
             if (!empty($newcomer->email)) {
                 $list[$newcomer->email] = ['name' => $newcomer->first_name . ' ' . $newcomer->last_name, 'user' => $newcomer];
             } elseif (!empty($newcomer->registration_email)) {
                 $list[$newcomer->registration_email] = ['name' => $newcomer->first_name . ' ' . $newcomer->last_name, 'user' => $newcomer];
             }
         }
         // Set count in db
         $email->done = 0;
         $email->total = count($list);
         $email->save();
         // Send emails
         $delay = 0;
         foreach ($list as $dest => $val) {
             $this->currentUser = $val['user'];
             $view = $email->template;
             if ($email->is_plaintext) {
                 $view = preg_replace_callback('/{{([A-Z0-9_]+)}}/i', array($this, 'replaceCallback'), $view);
//.........这里部分代码省略.........
开发者ID:ungdev,项目名称:integration-UTT,代码行数:101,代码来源:PutScheduledEmailToQueue.php

示例5: matchReferrals

 /**
  * Match all newcomer without a referral to a referral
  *
  * In this algorithme, we first try to match godsons to referral of the same branch
  * Then we try to match them we other branch if there is no space left.
  *
  * Current algorithme as 7 big steps :
  *
  * * STEP 1 : Creation of $counts and $counts2 arrays.
  * $counts is used in steps 2 and 3 to lower the number of queries to DB.
  * And $counts2 is used in steps X, X and X to lower the number of queries to DB.
  * The only difference between theses two arrays is that user are grouped by branch in the first one.
  *
  * * STEP 2 : Calculate the future number of godson for each referrals.
  * We get the number of newcomers and we add one to each referral until reaching their wanted maximum.
  * If there is still newcomers when all maximums are reached, we increment the maximum
  * (with $counts[branch]['+1']) for everyone except thoses with a maximum at 5 (6 godsons is really too much)
  * and we do it again until reaching the $MAXIMUM_OVERFLOW.
  *
  * * STEP 3 : Give godsons to referrals according to the calculated value in
  * precedent step and according to referral and godsons location.
  * For every newcomers, we take all referrals of his branch that have place left
  * and we try to match them by full postal_code and country. If there is a match
  * We associate them, if there is a multiple match, we take a random referral in the list
  * If there is no match we pass this newcomer and try with another one. At the
  * end of the newcomer list, we try agains with the newcomer that we have passed
  * with another matching solution. We do this again with all theses matching solution :
  *   * Full postal code
  *   * French departement code
  *   * French region
  *   * Country
  * If there is still no match, we try to match newcomers with everyone of his branch
  *
  * * STEP 4 : Remove PMOM and Master from left newcomers
  * We will now try to match newcomers with referral from other branches.
  * So we remove PMOM and masters because we don't want to associate them
  * with other branch referrals.
  *
  * * STEP 5 : Calculate the future number of godson for each referrals.
  * It's like the step 2 but we match newcomers with all branches
  * * STEP 6 : Give godsons to referrals according to the calculated value in
  * It's like the step 3 but we match newcomers with all branches
  *
  * * STEP 7 : If everyone has now a referral we save everything to DB
  *
  * Good luck if you want to edit this algo :)
  *
  */
 public static function matchReferrals()
 {
     // Settings you can tweak
     $MAXIMUM_OVERFLOW = 2;
     // Maximum of godson that can be added to a referral original max
     /***********************************************************************
      * STEP 1 : Creation of $counts and $counts2 arrays.
      **********************************************************************/
     // This array is created to minimize the number of query to db
     /*$counts = [
           'TC' => [
               42 => [ // 42 is a referral id
                   'current' => XX, // Current number of godson
                   'future' => XX, // Number of godson that will be associated at the end of the next step
                   'max' => XX, // Maximum number of godson asked by referral
                   '+1' => X, // Number of godson that can be added to `max` because there is not enough referrals. Used in step 2
                   '+1r2' => X, // Number of godson that can be added to `max` because there is not enough referrals. Used in step X
                   'student' => X, // Instance of the referral
               ]
               // referrals are deleted from the array once they reach the maximum
           ]
       ];
       $counts2 = [
           42 => [ // 42 is a referral id
               'current' => XX, // Current number of godson
               'future' => XX, // Number of godson that will be associated at the end of the next step
               'max' => XX, // Maximum number of godson asked by referral
               '+1' => X, // Number of godson that can be added to `max` because there is not enough referrals. Used in step 2
               '+1r2' => X, // Number of godson that can be added to `max` because there is not enough referrals. Used in step X
               'student' => X, // Instance of the referral
           ]
           // referrals are deleted from the array once they reach the maximum
       ];*/
     $counts = [];
     $counts2 = [];
     $referrals = Student::where(['referral' => 1, 'referral_validated' => 1])->get();
     foreach ($referrals as $referral) {
         if (!isset($counts[$referral->branch])) {
             $counts[$referral->branch] = [];
         }
         if ($referral->branch != 'MP') {
             // Remove masters
             $counts[$referral->branch][$referral->student_id] = ['current' => $referral->newcomers->count(), 'future' => $referral->newcomers->count(), 'max' => $referral->referral_max, '+1' => 0, '+1r2' => 0, 'student' => $referral];
         }
         // This array is used when there is no place left in some branches and we put godson from a branch to a referral from another
         if ($referral->branch != 'TC' && $referral->branch != 'MM' && $referral->branch != 'MP') {
             // Remove masters because they cannot have an engineer godson
             $counts2[$referral->student_id] =& $counts[$referral->branch][$referral->student_id];
         }
     }
     /***********************************************************************
      * STEP 2 : Calculate the future number of godson for each referrals
//.........这里部分代码省略.........
开发者ID:ungdev,项目名称:integration-UTT,代码行数:101,代码来源:NewcomerMatching.php

示例6: exportStudentList

 public function exportStudentList()
 {
     // work on the export
     $csv = \League\Csv\Writer::createFromFileObject(new \SplTempFileObject());
     $csv->setOutputBOM(Reader::BOM_UTF8);
     $dbColumn = Input::get('hdndbColumn');
     $value = Input::get('hdnvalue');
     if ($dbColumn != "all") {
         $infos = Student::where($dbColumn, '=', $value)->orderBy('lname', 'asc')->get();
     } else {
         $infos = Student::all();
     }
     $headers = Schema::getColumnListing('student_record');
     $notInclude = ["id", "created_at", "updated_at"];
     $x = 0;
     foreach ($headers as $header) {
         if (in_array($header, $notInclude)) {
             unset($headers[$x]);
         }
         $x++;
     }
     $csv->insertOne($headers);
     foreach ($infos as $info) {
         $data = array();
         foreach ($headers as $header) {
             if ($header == "section") {
                 $data[count($data)] = $this->secInfo($info[$header])['description'];
             } elseif ($header == "year_lvl") {
                 $data[count($data)] = $this->yearInfo($info[$header])['description'];
             } else {
                 $data[count($data)] = $info[$header];
             }
         }
         $csv->insertOne($data);
     }
     $date_now = date('Y-m-d-H:i:s');
     $filename = 'student_record(' . $date_now . ').csv';
     $csv->output($filename);
 }
开发者ID:jhunel2389,项目名称:hp-sis,代码行数:39,代码来源:GlobalController.php

示例7: find

 public function find($id)
 {
     return $this->student->where('id', (int) $id)->first();
 }
开发者ID:rtablada,项目名称:student-grading,代码行数:4,代码来源:DbStudentGateway.php

示例8: saveenrollment

 /**
  * Todo: Add validator to check wether current course has not been registered nor existed
  * @param Request $request
  * @return $this
  */
 public function saveenrollment(Request $request)
 {
     $input = $request->all();
     $validator = $this->enrollment_validator($input);
     if ($validator->fails()) {
         $this->throwValidationException($request, $validator);
     }
     //get data from the form
     $enrollment = new Enrollment();
     $enrollment->kode_seksi = $input['kode_seksi'];
     //query noreg from current user
     $user = Auth::user();
     $noreg = Student::where('id_user', $user->id)->first()->Noreg;
     $enrollment->noreg = $noreg;
     $enrollment->save();
     return $this->enrollmhs();
 }
开发者ID:mekas,项目名称:absenv2,代码行数:22,代码来源:StudentController.php

示例9: slidesBranch

 public function slidesBranch()
 {
     return View::make('dashboard.referrals.slides', ['referrals' => Student::where('referral', 1)->where('referral_validated', 1)->where('branch', '<>', 'TC')->orderBy('last_name')->get()]);
 }
开发者ID:ungdev,项目名称:integration-UTT,代码行数:4,代码来源:ReferralsController.php


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