本文整理汇总了PHP中app\models\Student::select方法的典型用法代码示例。如果您正苦于以下问题:PHP Student::select方法的具体用法?PHP Student::select怎么用?PHP Student::select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Student
的用法示例。
在下文中一共展示了Student::select方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getExportTeams
/**
* Export the teams and CE into a CSV file.
*
* @return string
*/
public function getExportTeams()
{
$students = Student::select(['first_name', 'last_name', 'phone', 'email', 'team_id'])->orderBy('last_name')->where('ce', 1)->whereNotNull('team_id')->where('team_accepted', 1)->join('teams as t', 't.id', '=', 'students.team_id')->addSelect(\DB::raw('t.name as team_name'))->get();
return Excel::create('Teams', function ($file) use($students) {
$file->sheet('', function ($sheet) use($students) {
$sheet->fromArray($students);
});
})->export('csv');
}
示例2: list
/**
*
* @return Response
*/
public function list()
{
// Find students
$students = Student::select([DB::raw('student_id AS id'), 'first_name', 'last_name', 'phone', DB::raw('1 AS student'), DB::raw('1 AS parent_authorization'), 'wei_payment', 'sandwich_payment', 'guarantee_payment', DB::raw('(ce AND team_accepted) AS ce'), 'volunteer', 'orga', 'wei_validated'])->where('wei', 1)->with('weiPayment')->with('sandwichPayment')->with('guaranteePayment');
// Find newcomers
$newcomer = Newcomer::select(['id', 'first_name', 'last_name', 'phone', DB::raw('0 AS student'), 'parent_authorization', 'wei_payment', 'sandwich_payment', 'guarantee_payment', DB::raw('0 AS ce'), DB::raw('0 AS volunteer'), DB::raw('0 AS orga'), DB::raw('1 AS wei_validated')])->where('wei', 1)->with('weiPayment')->with('sandwichPayment')->with('guaranteePayment');
// Union between newcomers and students
$users = $students->union($newcomer)->orderBy('last_name')->get();
return View::make('dashboard.wei.list', ['users' => $users]);
}
示例3: prematch
public function prematch()
{
return View::make('dashboard.referrals.prematch', ['referralCountries' => Student::select('country')->where(['referral' => 1, 'referral_validated' => 1])->groupBy('country')->lists('country'), 'newcomerCountries' => Newcomer::select('country')->groupBy('country')->lists('country'), 'referralBranches' => Student::select('branch')->where(['referral' => 1, 'referral_validated' => 1])->groupBy('branch')->lists('branch'), 'newcomerBranches' => Newcomer::select('branch')->groupBy('branch')->lists('branch')]);
}