本文整理匯總了PHP中app\models\Profile::whereXh方法的典型用法代碼示例。如果您正苦於以下問題:PHP Profile::whereXh方法的具體用法?PHP Profile::whereXh怎麽用?PHP Profile::whereXh使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類app\models\Profile
的用法示例。
在下文中一共展示了Profile::whereXh方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: handle
/**
* Handle the event.
*
* @param Login $event
* @return void
*/
public function handle(Login $event)
{
if (!Fresh::whereXh(Auth::user()->xh)->exists()) {
if (!Profile::whereXh(Auth::user()->xh)->whereXjzt(config('constants.school.student'))->exists()) {
Auth::logout();
return back()->withInput()->withStatus('不是在校生,請不要登錄係統');
}
}
session(['year' => Setting::find('XK_ND')->value, 'term' => Setting::find('XK_XQ')->value, 'campus' => Auth::user()->profile->college->pivot->xq, 'season' => Auth::user()->profile->zsjj, 'grade' => Auth::user()->profile->nj, 'major' => Auth::user()->profile->zy]);
$log = new Slog();
$log->ip = request()->ip();
$log->czlx = 'login';
$log->save();
}
示例2: boot
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
view()->composer('app', function ($view) {
// 是否新生
if ($is_fresh = Fresh::whereXh(Auth::user()->xh)->exists()) {
$user = Fresh::find(Auth::user()->xh);
}
// 是否在校生
if ($is_student = Profile::whereXh(Auth::user()->xh)->whereXjzt(config('constants.school.student'))->exists()) {
$user = Profile::find(Auth::user()->xh);
}
// 是否新入校未足一年的學生
$is_newer = Profile::isFresh(Auth::user())->exists();
// 是否允許選課
$allowed_select = Setting::find('XK_KG')->value;
// 是否允許選通識素質課
$allowed_general = Setting::find('XK_TS')->value;
// 是否允許選其他課程
$allowed_others = Setting::find('XK_QT')->value;
// 是否允許公體選課
$allowed_pubsport = Setting::find('XK_GT')->value;
$view->withIsFresh($is_fresh)->withIsStudent($is_student)->withUser($user)->withIsNewer($is_newer)->withAllowedSelect($allowed_select)->withAllowedGeneral($allowed_general)->withAllowedOthers($allowed_others)->withAllowedPubsport($allowed_pubsport);
});
}
示例3: show
/**
* 顯示可選課程列表
* @author FuRongxin
* @date 2016-02-23
* @version 2.0
* @param string $type 課程類型
* @return \Illuminate\Http\Response 可選課程列表
*/
public function show($type)
{
if ('pubsport' == $type) {
if (config('constants.status.disable') == Setting::find('XK_GT')->value) {
abort(403, '現在未開放公體選課,不允許公體選課');
}
} elseif (config('constants.status.disable') == Setting::find('XK_KG')->value) {
abort(403, '現在未開放選課,不允許選課');
}
if (Unpaid::whereXh(Auth::user()->xh)->exists()) {
abort(403, '請交清費用再進行選課');
}
if ('pubsport' != $type) {
if (config('constants.status.enable') == Setting::find('XK_SJXZ')->value) {
$profile = Profile::whereXh(Auth::user()->xh)->select('nj', 'xz')->firstOrFail();
// 未在時間限製表中配置,默認不允許選課
$now = Carbon::now();
$exists = Lmttime::whereNj($profile->nj)->whereXz($profile->xz)->where('kssj', '<', $now)->where('jssj', '>', $now)->exists();
if (!$exists) {
abort(403, '現在未到選課時間,不允許選課');
}
}
}
if (in_array($type, array_keys(config('constants.course.general')))) {
if (config('constants.stauts.disable') == Setting::find('XK_TS')->value) {
abort(403, '現在未開放通識素質課選課,不允許選課');
}
if (config('constants.status.enable') == Setting::find('XK_TSXZ')->value) {
$profile = Profile::whereXh(Auth::user()->xh)->select('nj', 'xz')->firstOrFail();
// 未在時間限製表中配置,默認不允許選通識素質課
$now = Carbon::now();
$exists = Lmtgeneral::whereNj($profile->nj)->whereXz($profile->xz)->where('kssj', '<', $now)->where('jssj', '>', $now)->exists();
if (!$exists) {
abort(403, '現在未到通識素質課選課時間,不允許選課');
}
}
$type_name = config('constants.course.general.' . $type . '.name');
}
$type_name = isset($type_name) ? $type_name : config('constants.course.' . $type . '.name');
$campuses = Campus::all()->each(function ($course) {
if (empty($course->dm)) {
$course->dm = 'unknown';
$course->mc = '未知';
}
});
return view('selcourse.show')->withTitle($type_name . '選課表')->withType($type)->withCampuses($campuses);
}