/** * 显示新生信息填报表 * @author FuRongxin * @date 2016-02-06 * @version 2.0 * @param string $xh 12位学号 * @return \Illuminate\Http\Response */ public function edit($xh) { if ($this->allowUpdate()) { if (Auth::user()->xh === $xh) { $profile = Fresh::find($xh); return view('fresh.edit')->withTitle('新生信息核对')->withInfo('初次登录请务必修改密码,若密码忘记请联系年级辅导员初始化。')->withProfile($profile); } abort(404, '学号不匹配'); } abort(403, '不允许填报信息'); }
/** * 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); }); }