public function homepage()
 {
     $user = \Auth::user();
     $user_id = $user->id;
     $admin_id = admin::where('id', '=', $user_id)->get();
     if (count($admin_id)) {
         $teams = team::all();
         $competitions = competition::all();
         return view('admin', compact('teams', 'competitions'));
     } else {
         $teamcontent = team_contents::where('studentID', '=', $user->id)->get(array('teamID'));
         $teamname = array();
         foreach ($teamcontent as $teamId) {
             $name = team::where('teamID', '=', $teamId->teamID)->get(array('teamName'));
             $t = array();
             array_push($t, $teamId->teamID);
             array_push($t, $name[0]->teamName);
             array_push($teamname, $t);
         }
         return view('home', compact('teamname', 'user'));
     }
 }
 public function homepage()
 {
     $user = \Auth::user();
     $user_id = $user->id;
     $admin_id = admin::where('id', '=', $user_id)->get();
     //return $admin_id;
     //$admin_id = $admin_id[0]->id;
     if (count($admin_id)) {
         $teams = team::all();
         $teamnames = array();
         foreach ($teams as $t) {
             array_push($teamnames, $t->teamName);
         }
         return view('admin', compact('teamnames'));
     } else {
         //return $pref[0]->python;
         // return $user->id;
         $teamcontent = team_contents::where('studentID', '=', $user->id)->get(array('teamID'));
         $teamname = array();
         foreach ($teamcontent as $teamId) {
             $name = team::where('teamID', '=', $teamId->teamID)->get(array('teamName'));
             array_push($teamname, $name[0]->teamName);
         }
         // return $teamname;
         // return $user;
         //$team = find($user->)
         return view('home', compact('teamname'), compact('user'));
     }
 }
 public function run()
 {
     DB::table('team_contents')->delete();
     team_contents::create(['teamID' => '1', 'studentID' => '1']);
     team_contents::create(['teamID' => '1', 'studentID' => '2']);
     team_contents::create(['teamID' => '1', 'studentID' => '3']);
     team_contents::create(['teamID' => '1', 'studentID' => '4']);
     team_contents::create(['teamID' => '1', 'studentID' => '5']);
     team_contents::create(['teamID' => '2', 'studentID' => '6']);
     team_contents::create(['teamID' => '2', 'studentID' => '7']);
     team_contents::create(['teamID' => '2', 'studentID' => '8']);
     team_contents::create(['teamID' => '2', 'studentID' => '9']);
     team_contents::create(['teamID' => '2', 'studentID' => '10']);
     team_contents::create(['teamID' => '3', 'studentID' => '1']);
     team_contents::create(['teamID' => '3', 'studentID' => '2']);
     team_contents::create(['teamID' => '3', 'studentID' => '11']);
     team_contents::create(['teamID' => '4', 'studentID' => '12']);
     team_contents::create(['teamID' => '4', 'studentID' => '13']);
     team_contents::create(['teamID' => '4', 'studentID' => '14']);
     team_contents::create(['teamID' => '5', 'studentID' => '1']);
     team_contents::create(['teamID' => '5', 'studentID' => '15']);
     team_contents::create(['teamID' => '5', 'studentID' => '16']);
     team_contents::create(['teamID' => '5', 'studentID' => '17']);
     team_contents::create(['teamID' => '6', 'studentID' => '18']);
     team_contents::create(['teamID' => '6', 'studentID' => '19']);
     team_contents::create(['teamID' => '6', 'studentID' => '20']);
     team_contents::create(['teamID' => '6', 'studentID' => '21']);
 }