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();
         $competitions = competition::all();
         $compID = array();
         $compName = array();
         $teamnames = array();
         foreach ($competitions as $c) {
             array_push($compID, $c->compID);
             array_push($compName, $c->compName);
         }
         foreach ($teams as $t) {
             array_push($teamnames, $t->teamName);
         }
         return view('admin', compact('teamnames', 'compID', 'compName'));
     } 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('competition')->delete();
     competition::create(['compName' => 'Coding is fun!']);
     competition::create(['compName' => 'Coding isn\'t fun!']);
     competition::create(['compName' => 'Coding is meh...']);
 }