Esempio n. 1
0
 public function save($data1, $data2)
 {
     $team = new Team();
     $team->name = $data1;
     $team->nbplayers = $data2;
     $team->save();
 }
Esempio n. 2
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $type = $this->argument('type');
     $libequipe = $this->argument('libequipe');
     $libdivision = $this->argument('libdivision');
     $liendivision = $this->argument('liendivision');
     if (is_array($libequipe)) {
         $libequipe = $libequipe[0];
     }
     if (is_array($libdivision)) {
         $libdivision = $libdivision[0];
     }
     if (is_array($liendivision)) {
         $liendivision = $liendivision[0];
     }
     $this->info('[' . date('d/m/Y H:i:s') . '][FFTT:Team] STARTING libequipe=' . $libequipe . ' libdivision=' . $libdivision);
     $team = Team::where('libequipe', $libequipe)->where('libdivision', $libdivision)->where('liendivision', $liendivision)->first();
     if ($team == null) {
         $team = new Team();
         $team->libequipe = $libequipe;
         $team->libdivision = $libdivision;
         $team->liendivision = $liendivision;
         $team->type = $type;
         $team->active = 1;
         $team->Save();
     } else {
         $team->active = 1;
         $team->Save();
     }
     Artisan::queue('FFTT:Ranking', ['id' => $team->id, 'liendivision' => $team->liendivision]);
     Artisan::queue('FFTT:Matchs', ['id' => $team->id, 'liendivision' => $team->liendivision]);
     $team->touch();
     $this->info('[' . date('d/m/Y H:i:s') . '][FFTT:Team] ENDING libequipe=' . $libequipe . ' libdivision=' . $libdivision);
 }
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $team = new Team();
     if ($team->where('user_id', session('login_web_59ba36addc2b2f9401580f014c7f58ea4e30989d'))->first()) {
         return new RedirectResponse(url('add_player_in_team'));
     }
     return $next($request);
 }
 public function index($name)
 {
     $team = new Team();
     if (!$team->where('team_name', $name)->first()) {
         return redirect()->back();
     }
     $res = $team->join('fantasy_user_players', 'fantasy_teams.team_id', '=', 'fantasy_user_players.team_id')->join('fantasy_players', 'fantasy_user_players.id', '=', 'fantasy_players.player_id')->where('team_name', $name)->get();
     return view('front.test')->with('team', $res);
 }
Esempio n. 5
0
 public static function boot()
 {
     static::created(function ($user) {
         if (User::count() == 1) {
             $systemTeam = new Team();
             $systemTeam->name = 'System Administrators';
             $systemTeam->save();
             $user->attachTeam($systemTeam);
             $workflowTeam = new Team();
             $workflowTeam->name = 'Workflow Administrators';
             $workflowTeam->save();
             $user->attachTeam($workflowTeam);
         }
     });
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index(Request $request)
 {
     $this->generateSessionValueIfNotExists();
     $data['teams'] = [];
     $teams = Team::orderBy('name', 'asc')->get();
     foreach ($teams as $team) {
         $isFavourite = Rating::where('session', '=', $_SESSION["session"])->where('team_id', '=', $team->id)->get();
         if (count($isFavourite) > 0) {
             $team->isFavourite = true;
         } else {
             $team->isFavourite = false;
         }
         array_push($data['teams'], $team);
     }
     //$data['ratings'] = Rating::all();
     $data['ratings'] = DB::select('select count(*) as votos, t.name as equipo, t.link as enlace, u.name as usuario
                         from ratings as r
                         join teams as t on r.team_id = t.id
                         join users as u on t.user_id = u.id
                         group by r.team_id
                         order by votos desc, t.name asc');
     //dd($data);
     $data['last_teams'] = Team::orderBy('id', 'desc')->limit(5)->get();
     $data['users'] = User::all();
     return view('welcome.welcome', $data);
 }
Esempio n. 7
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $teams = \App\Team::all();
     foreach ($teams as $team) {
         factory(App\Player::class, 5)->create(['team_id' => $team->id]);
     }
 }
Esempio n. 8
0
 /**
  * publishs the tracking of terms with supervisor and phirehose
  *
  * @return \Illuminate\View\View
  */
 public function publish($team, $network_id)
 {
     $team = Team::where('slug', '=', $team)->first();
     $network = Network::find($network_id);
     $network = $network->title;
     $keys = json_decode($team->{$network});
     //Create GuzzleHttp client
     $guzzleClient = new \GuzzleHttp\Client();
     // Pass the url and the guzzle client to the XmlRpc Client
     $client = new Client('http://localhost:9001/RPC2', new HttpAdapterTransport(new Guzzle6HttpAdapter($guzzleClient)));
     // Generate XMLRpc and Supervisor Instances
     $connector = new XmlRpc($client);
     $supervisor = new Supervisor($connector);
     // setup flysystem
     $adapter = new Local('/etc/supervisor/conf.d/');
     $filesystem = new Filesystem($adapter);
     // create new supervisor files
     $writer = new File($filesystem, 'test.conf');
     $configuration = new Configuration();
     $section = $this->generateNewProcess($keys, $team->id);
     $configuration->addSection($section);
     $writer->write($configuration);
     // restart supervisor
     $supervisor->restart();
 }
Esempio n. 9
0
 public function team($id)
 {
     $faker = Faker::create();
     for ($i = 1; $i <= $faker->numberBetween(24, 30); $i++) {
         Team::create(['institution_id' => $faker->numberBetween('1', count(Institution::get())), 'name' => 'Team ' . $i, 'name_altered' => 'Team ' . $i, 'robot_name' => 'Robot ' . $i, 'gender' => $faker->randomElement(['MAS', 'FEM', 'MIX']), 'challenge_id' => $id, 'degree_id' => $faker->numberBetween('1', count(Degree::get()))]);
     }
 }
 /**
  * Display the home page.
  *
  * @return Response
  */
 public function index()
 {
     $teamResults = Team::orderBy('team_points', 'desc')->take(10)->get();
     $matchDb = new Match();
     $match = $matchDb->join('fantasy_club as home', 'fantasy_match.home_club_id', '=', 'home.club_id')->join('fantasy_club as guest', 'fantasy_match.guest_club_id', '=', 'guest.club_id')->select('home.club_name as home_name', 'guest.club_name as guest_name', 'match_date')->get();
     return view('front.index')->with('teamResults', $teamResults)->with('j', $j = 1)->with('matches', $match);
 }
Esempio n. 11
0
 /**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function create()
 {
     // Just return the view function.
     // If you want to add any data and pass it, just get the data and pass it as a second argument to view()
     $teams = Team::orderBy('name', 'asc')->get();
     return view('matches.create', compact('teams'));
 }
Esempio n. 12
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $this->info('[' . date('d/m/Y H:i:s') . '][FFTT:Teams] STARTING');
     $club = '18270175';
     $champMasculins = xml_equipe($club, 'M');
     $champFeminins = xml_equipe($club, 'F');
     $champOthers = xml_equipe($club, '');
     Team::where('active', 1)->update(['active' => 0, 'saison' => date('Y') . '-' . (date('Y') - 1)]);
     foreach ($champMasculins as $champ) {
         $this->info('[' . date('d/m/Y H:i:s') . '][FFTT:Team] STARTING libequipe=' . $champ->libequipe . ' libdivision=' . $champ->libdivision);
         Artisan::queue('FFTT:Team', ['type' => 'M', 'libequipe' => $champ->libequipe, 'libdivision' => $champ->libdivision, 'liendivision' => $champ->liendivision]);
         $this->info('[' . date('d/m/Y H:i:s') . '][FFTT:Team] ENDING libequipe=' . $champ->libequipe . ' libdivision=' . $champ->libdivision);
     }
     foreach ($champFeminins as $champ) {
         $this->info('[' . date('d/m/Y H:i:s') . '][FFTT:Team] STARTING libequipe=' . $champ->libequipe . ' libdivision=' . $champ->libdivision);
         Artisan::queue('FFTT:Team', ['type' => 'F', 'libequipe' => $champ->libequipe, 'libdivision' => $champ->libdivision, 'liendivision' => $champ->liendivision]);
         $this->info('[' . date('d/m/Y H:i:s') . '][FFTT:Team] ENDING libequipe=' . $champ->libequipe . ' libdivision=' . $champ->libdivision);
     }
     foreach ($champOthers as $champ) {
         $this->info('[' . date('d/m/Y H:i:s') . '][FFTT:Team] STARTING libequipe=' . $champ->libequipe . ' libdivision=' . $champ->libdivision);
         Artisan::queue('FFTT:Team', ['type' => '', 'libequipe' => $champ->libequipe, 'libdivision' => $champ->libdivision, 'liendivision' => $champ->liendivision]);
         $this->info('[' . date('d/m/Y H:i:s') . '][FFTT:Team] ENDING libequipe=' . $champ->libequipe . ' libdivision=' . $champ->libdivision);
     }
     $this->info('[' . date('d/m/Y H:i:s') . '][FFTT:Teams] ENDING');
 }
Esempio n. 13
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $staff_team = '';
     $leader = '';
     $pie_leader = '';
     $department = '';
     $department = Department::leftJoin('staff', 'department.id', '=', 'staff.department_id')->join('level', 'staff.level_id', '=', 'level.id')->join('role', 'level.role_id', '=', 'role.id')->select(DB::raw('department.name as name_dep,role.name,count(*) as num'))->groupBy('department.name', 'role.name')->get()->toArray();
     $num_staff = $department;
     $pie = array();
     foreach ($department as $value) {
         $pie[$value['name_dep']][] = array($value['name'], (int) $value['num']);
     }
     // is Leader
     if (Gate::allows('check-leader')) {
         $department = Department::leftJoin('staff', 'department.id', '=', 'staff.department_id')->join('level', 'staff.level_id', '=', 'level.id')->join('role', 'level.role_id', '=', 'role.id')->select(DB::raw('department.name as name_dep,role.name,count(*) as num'))->where(['department.id' => Auth::user()->department_id, 'department.active' => 1])->groupBy('department.name', 'role.name')->get()->toArray();
         $num_staff = $department;
         $pie = array();
         foreach ($department as $value) {
             $pie[$value['name_dep']][] = array($value['name'], (int) $value['num']);
         }
     }
     // is Developer
     // if is manager / != department / yourself
     // denied
     if (Gate::allows('check-developer')) {
         $staff = StaffTeam::where('staff_id', Auth::user()->id)->get()->first();
         if (isset($staff) && !empty($staff)) {
             $staff_team = StaffTeam::where('team_id', $staff->team_id)->where('staff_id', '!=', Auth::user()->id)->get();
             $team = Team::where('id', $staff->team_id)->get()->first();
             $leader = Staff::find($team->creator);
         }
     }
     return view('admin.department.home', compact('pie', 'staff_team', 'leader', 'num_staff'));
 }
Esempio n. 14
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     //
     $list = Team::where('created_user_id', Auth::user()->id)->with('detail')->get();
     $title = "My Teams";
     return view('html.team.index', compact('list', 'title'));
 }
Esempio n. 15
0
 public function search(Request $request)
 {
     $results = array();
     $term = $request->get('term');
     $goals = Goal::where('body', 'like', '%' . $term . '%')->orderBy('body', 'asc')->get();
     $objectives = Objective::where('body', 'like', '%' . $term . '%')->orderBy('body', 'asc')->get();
     $actions = Action::where('body', 'like', '%' . $term . '%')->orderBy('body', 'asc')->get();
     $tasks = Task::where('body', 'like', '%' . $term . '%')->orderBy('body', 'asc')->get();
     $teams = Team::where('name', 'like', '%' . $term . '%')->orderBy('name', 'asc')->get();
     $departments = Department::where('name', 'like', '%' . $term . '%')->orderBy('name', 'asc')->get();
     $users = User::where('name', 'like', '%' . $term . '%')->orderBy('name', 'asc')->get()->all();
     foreach (User::where('email', 'like', '%' . $term . '%')->orderBy('name', 'asc')->get() as $matching_user_email) {
         if (in_array($matching_user_email, $users)) {
             continue;
         }
         $users[] = $matching_user_email;
     }
     $notes = Note::where('content', 'like', '%' . $term . '%')->orderBy('content', 'asc')->get();
     $types = [$goals, $objectives, $actions, $tasks, $teams, $departments, $users, $notes];
     foreach ($types as $type) {
         foreach ($type as $result) {
             $results[] = $result;
         }
     }
     return view('search.show')->with('results', $results)->with('term', $term);
 }
Esempio n. 16
0
 /**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function create()
 {
     $leagues = League::all();
     $stadiums = Stadium::all();
     $teams = Team::all();
     return view('admin.fixtures.create', compact('leagues', $leagues, 'teams', $teams, 'stadiums', $stadiums));
 }
Esempio n. 17
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     // This gets all rows and all columns from the players table.
     // If you want to change this. You can select specific columns by passing an array of the column names in all()
     $teams = Team::orderBy('name', 'asc')->get();
     return view('dashboard', compact('teams'));
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker::create();
     foreach (Team::get() as $te) {
         RelationTeUs::create(['team_id' => $te->id, 'user_coach_id' => $faker->numberBetween(1, count(User::get())), 'user_coach_aux_id' => $faker->numberBetween(1, count(User::get())), 'user_coordinador_id' => $faker->numberBetween(1, count(User::get())), 'user_cap_id' => $faker->numberBetween(1, count(User::get())), 'user_int2_id' => $faker->numberBetween(1, count(User::get())), 'user_int3_id' => $faker->numberBetween(1, count(User::get())), 'user_int4_id' => $faker->numberBetween(1, count(User::get()))]);
     }
 }
Esempio n. 19
0
 /**
  * Return create tag view
  *
  * @return \Illuminate\View\View
  */
 public function create($team, $feed_id)
 {
     $team = Team::where('slug', '=', $team)->with('feeds')->first();
     $feed = Feed::with('tags.network')->where('id', '=', $feed_id)->first();
     $networks = Network::all();
     return view('admin.tags.create', ['feed' => $feed, 'team' => $team, 'networks' => $networks]);
 }
Esempio n. 20
0
 public function index()
 {
     $user = \Auth::user();
     $time = $this->formatDate();
     $action = 'home';
     $r = Signin::where('user_id', \Auth::user()->id)->first();
     $count = 0;
     $signined = false;
     if ($r) {
         $count = $r['count'];
         if (substr(Carbon::now(), 0, 10) == substr($r['last_signin'], 0, 10)) {
             $signined = true;
         }
     }
     $signinList = Signin::where('last_signin', 'like', substr(Carbon::now(), 0, 10) . '%')->orderBy('last_signin', 'desc')->get();
     foreach ($signinList as &$item) {
         $item['last_signin'] = substr($item['last_signin'], 11, 8);
     }
     $cates = Cate::orderBy('count', 'desc')->limit(6)->get();
     $authors = User::orderBy('score', 'desc')->limit(6)->get();
     $teams = Team::limit(3)->get();
     $recommendedArticles = Article::orderBy('recommend', 'deac')->limit(4)->get();
     $phpArticles = Article::where('cate_id', 1)->limit(5)->get();
     $todayHotArticles = Article::where('published_at', '>=', Carbon::now()->subDay(1))->where('published_at', '<=', Carbon::now())->orderBy('view', 'deac')->limit(6)->get();
     $weekHotArticles = Article::where('published_at', '>=', Carbon::now()->subDay(7))->where('published_at', '<=', Carbon::now())->orderBy('view', 'deac')->limit(6)->get();
     return view('home', compact('user', 'time', 'action', 'signin', 'minus', 'count', 'signined', 'signinList', 'cates', 'authors', 'teams', 'recommendedArticles', 'phpArticles', 'todayHotArticles', 'weekHotArticles'));
 }
Esempio n. 21
0
 public function franchise($franchiseID)
 {
     $teams = Team::where('franchID', '=', $franchiseID)->take(999);
     $franchise = Franchise::where('franchID', '=', $franchiseID)->first();
     $grids = TeamsController::grids($teams);
     return view('teams.franchise')->with(['name' => $franchise->franchName, 'narrowGrid' => $grids['narrowGrid'], 'grid' => $grids['grid']]);
 }
Esempio n. 22
0
 public function dashboard(Request $request)
 {
     $this->data['user'] = $request->user();
     $this->data['teams'] = Team::with('points')->get();
     $this->data['players'] = User::with(['points', 'team'])->get();
     $this->data['challenges'] = \App\Challenge::where('active_time', '<', date('Y-m-d H:i:s'))->get();
     return View::make('team.dashboard', $this->data);
 }
Esempio n. 23
0
 public function save(Request $request)
 {
     $team = Team::firstOrNew(['account_id' => $request->account]);
     $team->account_id = $request->account;
     $team->theData = json_encode($request->data);
     $team->save();
     return $team;
 }
Esempio n. 24
0
 public function dashboard(Request $request)
 {
     $this->data['teams'] = \App\Team::with('points')->get();
     $this->data['roles'] = \App\Role::get();
     $this->data['adminUser'] = \App\User::find(1);
     $this->data['users'] = \App\User::where('id', '>', 1)->with('points')->get()->sortByDesc('amount');
     return View::make('admin.dashboard', $this->data);
 }
 public function store(Request $request)
 {
     $team = new Team();
     if ($request->team_name == '' || strlen($request->team_name) < 5) {
         return TeamController::index('Komandos vardas per trumpas.');
     } elseif ($team->where('team_name', $request->team_name)->first()) {
         return TeamController::index('Toks vardas jau egzistuoja.');
     } elseif ($team->where('user_id', $request->user()->id)->first()) {
         return TeamController::index('Jūs jau turite komandą.');
     } else {
         $team->team_name = $request->team_name;
         //$team->user_id = $request->session()->get('login_web_59ba36addc2b2f9401580f014c7f58ea4e30989d');
         $team->user_id = $request->user()->id;
         $team->save();
         return new RedirectResponse(url('add_player_in_team'));
     }
 }
Esempio n. 26
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $staff_id = (int) $request->staffId;
     $staff = Staff::find($staff_id);
     // is Leader
     // if is manager / != department / yourself
     // denied
     if (Gate::allows('check-leader')) {
         if ($staff->level->role->name == 'Manager' || $staff->department_id != Auth::user()->department_id || $staff->id == Auth::user()->id) {
             return redirect()->route('admin.staff.index')->with('message', 'Access is denied');
         }
     }
     // is Manager
     if (Gate::allows('check-manager')) {
         if ($staff->level->role->name == 'Manager') {
             return redirect()->route('admin.staff.index')->with('message', 'Access is denied');
         }
     }
     // is Developer
     // if is manager / != department / yourself
     // denied
     if (Gate::allows('check-developer')) {
         if ($staff->level->role->name == 'Manager' || $staff->department_id != Auth::user()->department_id || $staff->id == Auth::user()->id) {
             return redirect()->route('admin.department.index');
         }
         // if != leader of team
         $staff_team = StaffTeam::where('staff_id', Auth::user()->id)->get()->first();
         if (!empty($staff_team)) {
             $team = Team::where('id', $staff_team->team_id)->get()->first();
             if ($staff->level->role->name == 'TeamLeader' && $staff->id != $team->creator) {
                 return redirect()->route('admin.department.index');
             }
         } else {
             return redirect()->route('admin.department.index');
         }
     }
     $this->validate($request, ['point' => 'required|numeric', 'review' => 'required', 'staffId' => 'required|numeric', 'rActive' => 'required|numeric']);
     $review = ReView::where(['reviewer_id' => Auth::user()->id, 'staff_id' => $staff_id])->get()->first();
     // review less than 30 days!
     // denied
     if (isset($review) && !empty($review)) {
         $time = strtotime($review->created_at);
         $curtime = time();
         if ($curtime - $time < 3600 * 24 * 30) {
             return redirect()->route('admin.department.index')->with('message', 'less than 30 days!');
         }
     }
     $point = (int) $request->point;
     $reviewer = Auth::user()->id;
     $review = new Review();
     $review->staff_id = $staff_id;
     $review->reviewer_id = $reviewer;
     $review->point = $point;
     $review->comment = $request->review;
     $review->active = $request->rActive;
     $review->save();
     return redirect()->route('admin.review.show', $staff_id)->with('message', 'Create review complete!');
 }
Esempio n. 27
0
 /**
  * The game page itself
  *
  * @return Response
  */
 public function index()
 {
     $ws = Websitespel::where("ended", false)->orderBy('start_date')->first();
     if ($ws == null) {
         //no games in progress and none planned
         //return done
         return view('game.ended')->with('countDown', false);
     } else {
         if ($ws->start_date > \Carbon\Carbon::now()) {
             // do the countdown
             // return countdown
             return view('game.countdown')->with('countDown', $ws);
         }
     }
     // else carry on
     $team = Auth::user()->team()->first();
     $questionNr = count(Progress::where('team_id', $team->id)->get());
     $question = null;
     $tip = false;
     $times = [];
     if ($questionNr != count(Question::all())) {
         $question = Question::where('sequence', $questionNr + 1)->first();
         $result = QuestionTime::where('team_id', $team->id)->where('question_id', $question->id)->get();
         if (count($result) == 0) {
             $questionTime = new QuestionTime();
             $questionTime->team_id = $team->id;
             $questionTime->question_id = $question->id;
             $questionTime->tip = false;
             $questionTime->start_time = \Carbon\Carbon::now()->timestamp;
             $questionTime->save();
             $tip = false;
         } else {
             $tip = $result->first()->tip;
         }
     } else {
         $teams = Team::all();
         $teamsCount = count($teams);
         $question_id = Question::where('sequence', Question::max('sequence'))->first()->id;
         for ($i = 0; $i < $teamsCount; $i++) {
             $qt = QuestionTime::where('team_id', $teams[$i]->id)->where('question_id', $question_id)->first();
             if ($qt == null) {
                 continue;
             }
             $end_time = $qt->end_time;
             if ($end_time == null) {
                 continue;
             }
             $end_time_string = \Carbon\Carbon::createFromTimestamp($end_time);
             array_push($times, array('name' => $teams[$i]->teamname, 'time' => $end_time_string, 'countDown' => 0));
         }
         usort($times, function ($a, $b) {
             return $a['time']->timestamp - $b['time']->timestamp;
         });
     }
     return view('game.index')->with(array('question' => $question, 'tip' => $tip, 'end_times' => $times, 'countDown', null));
 }
Esempio n. 28
0
 /**
  * [run description]
  * @return [type] [description]
  */
 public function run()
 {
     DB::table('teams')->delete();
     $race = Db::table('races')->select('id')->first();
     Team::create(array('name' => 'Schnell', 'race_id' => $race->id));
     Team::create(array('name' => 'Ichi Ban', 'race_id' => $race->id));
     Team::create(array('name' => 'Team Pizza', 'race_id' => $race->id));
     Team::create(array('name' => 'Mostly New Guys', 'race_id' => $race->id));
     Team::create(array('name' => 'Team Mongolia', 'race_id' => $race->id));
 }
 public function index(Request $request)
 {
     //$userPlayers = UserPlayers::where('user_id', $request->user()->id)->get();
     $userPlayers = $request->user()->userContractsPlayers;
     $players = new Players();
     $club = new Club();
     $match = $request->user()->userPlayers;
     $teamResults = Team::orderBy('team_points', 'desc')->take(10)->get();
     return view('front.team_player_list')->with('userPlayers', $userPlayers)->with('players', $players)->with('club', $club)->with('i', $i = 1)->with('match', $match)->with('team', $request->user()->team)->with('teamResults', $teamResults)->with('j', $j = 1);
 }
Esempio n. 30
0
 /**
  * Fills teams table
  *
  */
 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 10) as $index) {
         $t = Team::create(['name' => $faker->name(), 'abbreviation' => $faker->realText(11), 'description' => $faker->realText(150)]);
         $t->captain()->associate(User::first());
         $t->members()->attach(User::first());
         //set captain of all teams to first user
         $t->save();
     }
 }