当前位置: 首页>>代码示例>>PHP>>正文


PHP Profile::whereXh方法代码示例

本文整理汇总了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();
 }
开发者ID:rxfu,项目名称:student,代码行数:20,代码来源:AuthLoginListener.php

示例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);
     });
 }
开发者ID:rxfu,项目名称:student,代码行数:29,代码来源:AppServiceProvider.php

示例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);
 }
开发者ID:rxfu,项目名称:student,代码行数:55,代码来源:SelcourseController.php


注:本文中的app\models\Profile::whereXh方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。