コード例 #1
0
ファイル: admin.php プロジェクト: nwinbush/CSCI445FinalPro
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $UserData = UserData::findOrFail(Auth::user()->id);
     if ($UserData->isAdmin != true) {
         return redirect('home');
     }
     return $next($request);
 }
コード例 #2
0
ファイル: UserProvider.php プロジェクト: hyrmedia/microweber
 static function findOrCreate(SocialiteUser $payload, $provider)
 {
     $user = UserData::where('data_id', '=', $payload->id)->get();
     if ($user->isEmpty()) {
         $data = ['email' => $payload->email, 'username' => $payload->name, 'password' => md5(time()), 'is_active' => 1];
         if (strpos($payload->name, ' ')) {
             $name = explode(' ', $payload->name);
             $data['first_name'] = $name[0];
             $data['last_name'] = $name[1];
         }
         $baseUser = new User($data);
         $baseUser->save();
         app()->cache_manager->delete('users');
         $user = new UserData(['user_id' => $baseUser->id, 'provider' => $provider, 'data_token' => $payload->token, 'data_raw' => json_encode($payload->user), 'data_name' => $payload->name, 'data_id' => $payload->id, 'data_email' => $payload->email, 'data_avatar' => $payload->avatar]);
         $user->save();
     } else {
         $user = $user->first();
     }
     return User::find($user->user_id);
 }
コード例 #3
0
 public function edit()
 {
     $UserData = UserData::firstOrNew(['id' => Auth::user()->id]);
     return view('dataform', compact('UserData'));
 }
コード例 #4
0
 public function changeStudentTeam($id, request $request)
 {
     $UserData = UserData::findOrFail($id);
     //return $UserData;
     $UserData->update($request->all());
     return $this->teamPage();
 }
コード例 #5
0
 public function run()
 {
     DB::table('UserData')->delete();
     UserData::create(['id' => '1', 'name' => 'Mickey Mouse', 'isAdmin' => true]);
     UserData::create(['id' => '2', 'name' => 'Donald Duck', 'team_style' => 'social', 'taken_programming_class' => '306', 'preferred_language' => 'c']);
     UserData::create(['id' => '3', 'name' => 'Jane Jetson', 'team_style' => 'social', 'taken_programming_class' => '306', 'preferred_language' => 'java']);
     UserData::create(['id' => '4', 'name' => 'Frodo Baggins', 'team_style' => 'social', 'taken_programming_class' => '306', 'preferred_language' => 'python']);
     UserData::create(['id' => '5', 'name' => 'Bilbo Baggins', 'team_style' => 'social', 'taken_programming_class' => '261', 'preferred_language' => 'c']);
     UserData::create(['id' => '6', 'name' => 'Winnie Poohbear', 'team_style' => 'social', 'taken_programming_class' => '261', 'preferred_language' => 'java']);
     UserData::create(['id' => '7', 'name' => 'Daffy Duck', 'team_style' => 'social', 'taken_programming_class' => '261', 'preferred_language' => 'python']);
     UserData::create(['id' => '8', 'name' => 'Wile Coyote', 'team_style' => 'social', 'taken_programming_class' => '261', 'preferred_language' => 'c']);
     UserData::create(['id' => '9', 'name' => 'Road Runner', 'team_style' => 'social', 'taken_programming_class' => '262', 'preferred_language' => 'java']);
     UserData::create(['id' => '10', 'name' => 'Marge Simpson', 'team_style' => 'social', 'taken_programming_class' => '262', 'preferred_language' => 'python']);
     UserData::create(['id' => '11', 'name' => 'Charlie Brown', 'team_style' => 'social', 'taken_programming_class' => '262', 'preferred_language' => 'c']);
     UserData::create(['id' => '12', 'name' => 'Lucy VanPelt', 'team_style' => 'social', 'taken_programming_class' => '262', 'preferred_language' => 'java']);
     UserData::create(['id' => '13', 'name' => 'Bugs Bunny', 'team_style' => 'social', 'taken_programming_class' => '262', 'preferred_language' => 'python']);
     UserData::create(['id' => '14', 'name' => 'Betty Boop', 'team_style' => 'competitive', 'taken_programming_class' => '306', 'preferred_language' => 'c']);
     UserData::create(['id' => '15', 'name' => 'Lois Griffin', 'team_style' => 'competitive', 'taken_programming_class' => '306', 'preferred_language' => 'java']);
     UserData::create(['id' => '16', 'name' => 'Wilma Flintstone', 'team_style' => 'competitive', 'taken_programming_class' => '306', 'preferred_language' => 'python']);
     UserData::create(['id' => '17', 'name' => 'Fred Flintstone', 'team_style' => 'competitive', 'taken_programming_class' => '306', 'preferred_language' => 'c']);
     UserData::create(['id' => '18', 'name' => 'Peppa Pig', 'team_style' => 'competitive', 'taken_programming_class' => '306', 'preferred_language' => 'java']);
     UserData::create(['id' => '19', 'name' => 'Turanga Leela', 'team_style' => 'competitive', 'taken_programming_class' => '306', 'preferred_language' => 'python']);
     UserData::create(['id' => '20', 'name' => 'Sylvester Cat', 'team_style' => 'competitive', 'taken_programming_class' => '306', 'preferred_language' => 'c']);
     UserData::create(['id' => '21', 'name' => 'Felix Cat', 'team_style' => 'competitive', 'taken_programming_class' => '306', 'preferred_language' => 'java']);
     UserData::create(['id' => '22', 'name' => 'Top Cat', 'team_style' => 'competitive', 'taken_programming_class' => '261', 'preferred_language' => 'python']);
     UserData::create(['id' => '23', 'name' => 'Scooby Doo', 'team_style' => 'competitive', 'taken_programming_class' => '261', 'preferred_language' => 'c']);
     UserData::create(['id' => '24', 'name' => 'Porky Pig', 'team_style' => 'competitive', 'taken_programming_class' => '261', 'preferred_language' => 'java']);
     UserData::create(['id' => '25', 'name' => 'Garfield Cat', 'team_style' => 'competitive', 'taken_programming_class' => '261', 'preferred_language' => 'python']);
     UserData::create(['id' => '26', 'name' => 'Peter Pan', 'team_style' => 'competitive', 'taken_programming_class' => '261', 'preferred_language' => 'c']);
     UserData::create(['id' => '27', 'name' => 'Foghorn Leghorn', 'team_style' => 'competitive', 'taken_programming_class' => '261', 'preferred_language' => 'java']);
     UserData::create(['id' => '28', 'name' => 'Manning Peyton', 'team_style' => 'competitive', 'taken_programming_class' => '261', 'preferred_language' => 'python']);
     UserData::create(['id' => '29', 'name' => 'Green Virgil', 'team_style' => 'competitive', 'taken_programming_class' => '262', 'preferred_language' => 'c']);
     UserData::create(['id' => '30', 'name' => 'Thomas Julias', 'team_style' => 'competitive', 'taken_programming_class' => '262', 'preferred_language' => 'java']);
     UserData::create(['id' => '31', 'name' => 'Sanders Emmanuel', 'team_style' => 'competitive', 'taken_programming_class' => '262', 'preferred_language' => 'python']);
     UserData::create(['id' => '32', 'name' => 'Tamme Jason', 'team_style' => 'competitive', 'taken_programming_class' => '262', 'preferred_language' => 'c']);
     UserData::create(['id' => '33', 'name' => 'Knighton Terrance', 'team_style' => 'competitive', 'taken_programming_class' => '262', 'preferred_language' => 'java']);
     UserData::create(['id' => '34', 'name' => 'Colquitt Britton', 'team_style' => 'competitive', 'taken_programming_class' => '262', 'preferred_language' => 'python']);
     UserData::create(['id' => '35', 'name' => 'Roby Bradley', 'team_style' => 'dontcare', 'taken_programming_class' => '262', 'preferred_language' => 'c']);
     UserData::create(['id' => '36', 'name' => 'Ward T.J.', 'team_style' => 'dontcare', 'taken_programming_class' => '262', 'preferred_language' => 'java']);
     UserData::create(['id' => '37', 'name' => 'Ware DeMarcus', 'team_style' => 'dontcare', 'taken_programming_class' => '262', 'preferred_language' => 'python']);
     UserData::create(['id' => '38', 'name' => 'Webster, Kayvon', 'team_style' => 'dontcare', 'taken_programming_class' => '262', 'preferred_language' => 'c']);
 }
コード例 #6
0
 /**
  * Create a new user instance after a valid registration.
  *
  * @param  array  $data
  * @return User
  */
 protected function create(array $data)
 {
     $user = User::create(['name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password'])]);
     UserData::create(['name' => $user->name, 'id' => $user->id, 'isAdmin' => 0]);
     return $user;
 }