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 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 destroy($id)
 {
     $article = admin::findOrFail($id);
     $article->delete();
     return redirect('admin');
 }
 public function run()
 {
     DB::table('admin')->delete();
     admin::create(['id' => '1']);
 }