Ejemplo n.º 1
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::statement('SET FOREIGN_KEY_CHECKS = 0');
     // disable foreign key constraints
     DB::table('features')->truncate();
     /*
             Feature::create([
                 'href' => '/dm/home',
                 'btnclass' => 'btn-success',
                 'innerhtml' => '个人信息'
             ]);
     */
     Feature::create(['href' => '/patient', 'btnclass' => 'btn-primary', 'innerhtml' => '患者资料']);
     /*
             Feature::create([
                 'href' => '/case',
                 'btnclass' => 'btn-info',
                 'innerhtml' => '方案管理'
             ]);
     */
     Feature::create(['href' => '/bdata', 'btnclass' => 'btn-danger', 'innerhtml' => '血糖管理']);
     DB::table('hasfeatures')->truncate();
     Hasfeature::create(['user_id' => 2, 'feature_id' => 1]);
     Hasfeature::create(['user_id' => 2, 'feature_id' => 2]);
     /*
             Hasfeature::create([
                 'user_id' => 2,
                 'feature_id' => 3
             ]);
     */
     DB::statement('SET FOREIGN_KEY_CHECKS = 1');
     // enable foreign key constraints
 }
Ejemplo n.º 2
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (!Auth::check()) {
         return Redirect::route('login');
     } else {
         $ispatient = Hasfeature::where('user_id', Auth::user()->id)->where('feature_id', 1)->count();
         if (!$ispatient) {
             session()->flash('message_warning', '您不是合法使用者!无法进入相关区域');
             return Redirect::route('dm_home');
         }
     }
     return $next($request);
 }
Ejemplo n.º 3
0
 public function upload_hasfeature(Request $request)
 {
     $this->validate($request, Hasfeature::rules());
     $hasfeature = Hasfeature::where('id', $request->hasfeature_id)->first();
     $hasfeature->user_id = $request->user_id;
     $hasfeature->feature_id = $request->feature_id;
     $hasfeature->save();
     session()->flash('message', '操作更新成功');
     return Redirect::back();
 }