本文整理匯總了PHP中Illuminate\Database\Eloquent\Builder::whereXh方法的典型用法代碼示例。如果您正苦於以下問題:PHP Builder::whereXh方法的具體用法?PHP Builder::whereXh怎麽用?PHP Builder::whereXh使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Illuminate\Database\Eloquent\Builder
的用法示例。
在下文中一共展示了Builder::whereXh方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: scopeStudiedCredits
/**
* 擴展查詢,用於獲取已修讀學分
* @author FuRongxin
* @date 2016-01-23
* @version 2.0
* @param \Illuminate\Database\Eloquent\Builder $query 查詢對象
* @param object $user 用戶對象
* @return \Illuminate\Database\Eloquent\Builder 查詢對象
*/
public function scopeStudiedCredits($query, $user)
{
return $query->whereXh($user->xh)->groupBy('pt', 'kcxz')->selectRaw('pt, kcxz, SUM(xf) AS xf');
}
示例2: scopeIsFresh
/**
* 擴展查詢,用於查找學生是否是全日製本科新生
* @author FuRongxin
* @date 2016-02-22
* @version 2.0
* @param \Illuminate\Database\Eloquent\Builder $query 查詢對象
* @param object $user 用戶對象
* @return \Illuminate\Database\Eloquent\Builder 查詢對象
*/
public function scopeIsFresh($query, $user)
{
return $query->whereXh($user->xh)->whereXjzt(config('constants.school.student'))->whereRaw('age(CURRENT_DATE, date_trunc(\'month\', rxrq)) < \'1 year\'')->where('xz', '<>', '2');
}
示例3: scopeMakeupScore
/**
* 擴展查詢,用於獲取學生綜合成績對應的補考成績
* @author FuRongxin
* @date 2016-01-26
* @version 2.0
* @param \Illuminate\Database\Eloquent\Builder $query 查詢對象
* @param object $user 用戶對象
* @param string $kch 8位課程號
* @return \Illuminate\Database\Eloquent\Builder 查詢對象
*/
public function scopeMakeupScore($query, $user, $kch)
{
$lstKcxh = Task::whereKch($kch)->distinct('kcxh')->lists('kcxh');
// 提交狀態為3的成績方可顯示
return $query->whereXh($user->xh)->whereIn('kcxh', $lstKcxh)->whereTjzt(config('constants.score.dconfirmed'));
}
示例4: scopeStudied
/**
* 擴展查詢,獲取已修讀課程列表
* @author FuRongxin
* @date 2016-03-10
* @version 2.0
* @param \Illuminate\Database\Eloquent\Builder $query 查詢對象
* @param object $user 用戶對象
* @return \Illuminate\Database\Eloquent\Builder 查詢對象
*/
public function scopeStudied($query, $user)
{
return $query->whereXh($user->xh)->whereNotExists(function ($query) {
$query->from('xk_xkxx AS a')->whereNd(session('year'))->whereXq(session('term'))->whereRaw('t_a.xh = t_xk_xkxx.xh AND t_a.kcxh = t_xk_xkxx.kcxh');
});
}