Exemplo n.º 1
0
 /**
  * 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();
 }
Exemplo n.º 2
0
 /**
  * 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);
     });
 }
Exemplo n.º 3
0
 /**
  * 是否允许新生填报信息
  * @author FuRongxin
  * @date    2016-02-15
  * @version 2.0
  * @return  boolean true为允许,false为禁止
  */
 private function allowUpdate()
 {
     return Fresh::whereXh(Auth::user()->xh)->exists() && config('constants.status.enable') == Setting::find('XS_XSXX_KG')->value;
 }