public function campus() { $campus = Campus::all(); return view('encargado.campus', compact('campus')); }
public function campus() { $campus = Campus::all(); return view('administrador.campus', compact('campus')); }
/** * 显示可选课程列表 * @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); }