本文整理汇总了PHP中Program::select方法的典型用法代码示例。如果您正苦于以下问题:PHP Program::select方法的具体用法?PHP Program::select怎么用?PHP Program::select使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Program
的用法示例。
在下文中一共展示了Program::select方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: up
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('studentdelayed', function (Blueprint $table) {
$table->increments('id');
$table->integer('studentid');
$table->integer('programid');
$table->integer('collegeid');
$table->integer('semesters');
$table->timestamps();
});
$students = Studentdropout::select('studentid', 'programid', 'collegeid', 'semesters')->where('semesters', '>', 8)->get();
foreach ($students as $student) {
$programid = $student->programid;
$semesters = $student->semesters;
$programYears = Program::select('numyears')->where('programid', $programid)->first()->numyears;
if ($semesters > $programYears * 2) {
$newEntry = new Studentdelayed();
$newEntry->studentid = $student->studentid;
$newEntry->programid = $programid;
$newEntry->collegeid = $student->collegeid;
$newEntry->semesters = $semesters;
$newEntry->save();
}
}
}
示例2: up
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('studentdropouts', function (Blueprint $table) {
//
});
$students = Studentdropout::select('id', 'programid', 'semesters')->where('semesters', '>', 8)->get();
foreach ($students as $student) {
$programYears = Program::select('numyears')->where('programid', $student->programid)->first()->numyears;
if ($student->semesters > $programYears * 2) {
Studentdropout::find($student->id)->delete();
}
}
}
开发者ID:jpcamba,项目名称:attrition,代码行数:18,代码来源:2016_05_14_092001_delete_delayed_from_studentdropouts_table.php
示例3: getCollPrograms
public static function getCollPrograms($collegeid)
{
$departments = Department::select('unitid')->where('parentunitid', $collegeid)->groupBy('unitid')->get();
$departmentids = [];
foreach ($departments as $department) {
array_push($departmentids, $department->unitid);
}
$programs = Program::select('programid')->whereIn('unitid', $departmentids)->where('degreelevel', 'U')->groupBy('programid')->get();
$programids = [];
foreach ($programs as $program) {
array_push($programids, $program->programid);
}
return $programids;
}
示例4: up
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('correlations', function (Blueprint $table) {
//
});
$batches = [2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009];
$allStudents = [];
$programs = Program::select('programid')->get();
foreach ($programs as $program) {
$programid = $program->programid;
foreach ($batches as $batch) {
$allStudents[$batch] = Studentterm::getBatchStudentsProgram($batch * 100000, $programid);
}
$this->alterOverload($batches, $allStudents, $programid);
$this->alterUnits($batches, $allStudents, $programid);
}
}
开发者ID:jpcamba,项目名称:attrition,代码行数:22,代码来源:2016_04_08_182202_alter_overloading_units_program_in_correlations_table.php
示例5: up
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('studentdropouts', function (Blueprint $table) {
//
});
$students = Studentterm::getAllStudents();
foreach ($students as $student) {
$studentid = $student->studentid;
$programid = $this->getFinProgram($studentid);
$programYears = Program::select('numyears')->where('programid', $programid)->first()->numyears;
$studentsems = $this->countStudentSem($studentid, $programid);
if ($studentsems > $programYears * 2) {
$newEntry = new Studentdropout();
$newEntry->studentid = $studentid;
$newEntry->programid = $programid;
$newEntry->collegeid = Program::select('unitid')->where('programid', $programid)->first()->unitid;
$newEntry->semesters = $studentsems;
$newEntry->save();
}
}
}
示例6: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$correlation = [];
$rawCorrelation = [];
//Factors dropdown + names
$factors = Factor::select('factorid', 'factorname')->get();
$factorNames = [];
foreach ($factors as $factor) {
$factorNames[$factor->factorid] = $factor->factorname;
}
//Programs dropdown + names
$programs = Program::select('programtitle', 'programid')->where('degreelevel', 'U')->whereNotIn('programid', array(62, 66, 38, 22))->get();
$programNames = [];
foreach ($programs as $program) {
$programNames[$program->programid] = $program->programtitle;
}
//Departments dropdown
$departments = Department::whereHas('programs', function ($q) {
$q->whereNotIn('programid', array(62, 66, 38, 22));
$q->where('degreelevel', 'U');
})->get();
$departmentNames = [];
foreach ($departments as $department) {
$departmentNames[$department->unitid] = $department->unitname;
}
//Colleges dropdown
$colleges = [];
$collegeNames = [];
foreach ($departments as $department) {
$college = $department->college;
array_push($colleges, $college);
$collegeNames[$college->unitid] = $college->unitname;
}
$colleges = array_unique($colleges);
//Campus Level
$level = 'campus';
$id = -1;
$rawCorrelation[$level][$id][1] = $this->corrEmployment($level);
if ($rawCorrelation[$level][$id][1] < 0) {
$correlation[$level][$id][1] = -$rawCorrelation[$level][$id][1];
} else {
$correlation[$level][$id][1] = $rawCorrelation[$level][$id][1];
}
$rawCorrelation[$level][$id][2] = $this->corrGrades($level);
if ($rawCorrelation[$level][$id][2] < 0) {
$correlation[$level][$id][2] = -$rawCorrelation[$level][$id][2];
} else {
$correlation[$level][$id][2] = $rawCorrelation[$level][$id][2];
}
$rawCorrelation[$level][$id][3] = $this->corrStbracket($level);
if ($rawCorrelation[$level][$id][3] < 0) {
$correlation[$level][$id][3] = -$rawCorrelation[$level][$id][3];
} else {
$correlation[$level][$id][3] = $rawCorrelation[$level][$id][3];
}
$rawCorrelation[$level][$id][4] = $this->corrRegion($level);
if ($rawCorrelation[$level][$id][4] < 0) {
$correlation[$level][$id][4] = -$rawCorrelation[$level][$id][4];
} else {
$correlation[$level][$id][4] = $rawCorrelation[$level][$id][4];
}
$rawCorrelation[$level][$id][6] = $this->corrUnits($level);
if ($rawCorrelation[$level][$id][6] < 0) {
$correlation[$level][$id][6] = -$rawCorrelation[$level][$id][6];
} else {
$correlation[$level][$id][6] = $rawCorrelation[$level][$id][6];
}
$rawCorrelation[$level][$id][8] = $this->corrUnemployment($level);
if ($rawCorrelation[$level][$id][8] < 0) {
$correlation[$level][$id][8] = -$rawCorrelation[$level][$id][8];
} else {
$correlation[$level][$id][8] = $rawCorrelation[$level][$id][8];
}
$rawCorrelation[$level][$id][7] = $this->corrHighGrades($level);
if ($rawCorrelation[$level][$id][7] < 0) {
$correlation[$level][$id][7] = -$rawCorrelation[$level][$id][7];
} else {
$correlation[$level][$id][7] = $rawCorrelation[$level][$id][7];
}
$rawCorrelation[$level][$id][9] = $this->corrOverloading($level);
if ($rawCorrelation[$level][$id][9] < 0) {
$correlation[$level][$id][9] = -$rawCorrelation[$level][$id][9];
} else {
$correlation[$level][$id][9] = $rawCorrelation[$level][$id][9];
}
//College Level
$level = 'college';
foreach ($colleges as $college) {
$id = $college->unitid;
$rawCorrelation[$level][$id][1] = $this->corrEmployment($level, $id);
if ($rawCorrelation[$level][$id][1] < 0) {
$correlation[$level][$id][1] = -$rawCorrelation[$level][$id][1];
} else {
$correlation[$level][$id][1] = $rawCorrelation[$level][$id][1];
}
//.........这里部分代码省略.........