本文整理汇总了PHP中app\Team::all方法的典型用法代码示例。如果您正苦于以下问题:PHP Team::all方法的具体用法?PHP Team::all怎么用?PHP Team::all使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Team
的用法示例。
在下文中一共展示了Team::all方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* 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]);
}
}
示例2: create
/**
* 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));
}
示例3: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//
// get all the teams
$teams = Team::all();
return $teams;
}
示例4: index
/**
* 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));
}
示例5: teamStandings
/**
* Show team standings
* @return Response
*/
public function teamStandings()
{
$teams = Team::all()->sort(function ($a, $b) {
if ($a->points() == $b->points()) {
// ToDo: Sort on goal average in case two teams have the same points
return 0;
}
return $a->points() < $b->points() ? 1 : -1;
});
return view('standings.teams')->with('teams', $teams->values()->all());
}
示例6: fixtureTeam
public function fixtureTeam(Request $request)
{
$this->validate($request, ['team_title' => 'required', 'stadium_id' => 'required', 'file' => 'required|image|mimes:jpeg,jpg,png,bmp,gif,svg']);
//dd($request->all());
if ($request->file('file')) {
//$this->validate($request,['file'=>'required|image|mimes:jpeg,jpg,png,bmp,gif,svg']);
$file = $request->file('file');
$path = $this->_team_logo_path;
$name = uniqid() . $file->getClientOriginalName();
$file->move($path, $name);
}
$team = new Team(array('title' => $request->get('team_title'), 'stadium_id' => $request->get('stadium_id'), 'logo_name' => $name, 'logo_path' => $path));
$team->save();
$teams = Team::all();
return response()->json($teams);
}
示例7: generateScheduleByGroup
/**
* Show the form for creating a new resource.
*
* @return Response
*/
public function generateScheduleByGroup($group = null)
{
if ($group) {
$teams = Team::where('group', $group)->get();
} else {
$teams = Team::all();
}
$rows = array();
foreach ($teams as $host) {
foreach ($teams as $guest) {
if ($host->id != $guest->id && $host->group == $guest->group && !in_array(array('host' => $guest, 'guest' => $host), $rows)) {
$rows[] = array('host' => $host, 'guest' => $guest);
}
}
}
return view('schedule.index', compact('rows'));
}
示例8: getWdc
public function getWdc()
{
$wdc = Team::all()->where('kategori', 0);
return view('admin.wdcTable')->with('wdc', $wdc);
}
示例9: quizRanking
public function quizRanking($quizid)
{
$quiz = Quiz::find($quizid);
// RANKING CALC START
$tables = array();
foreach (json_decode($quiz->teams) as $table => $value) {
$tables[$table] = array();
$tables[$table]['team'] = intval($value->team);
$tables[$table]['pointsLevel0'] = intval($value->points);
$tables[$table]['pointsLevel1'] = 0;
$tables[$table]['pointsLevel2'] = 0;
$tables[$table]['pointsLevel3'] = 0;
$tables[$table]['points'] = 0;
$tables[$table]['tiebreaker'] = intval($value->tiebreak);
}
$questionsCollection = Question::where('quiz', $quizid)->get();
$questions = array();
foreach ($questionsCollection as $key => $value) {
$questions[$value->level][$value->genre][$value->tableid] = $value;
if ($value->tableid_remap == $value->tableid_score && $value->tableid_score) {
$points = 2;
} elseif ($value->tableid_score) {
$points = 1;
} else {
$points = 0;
}
if ($points && $value->tableid_score != '-1') {
switch ($value->level) {
case '1':
$tables[$value->tableid_score]['pointsLevel1'] = $tables[$value->tableid_score]['pointsLevel1'] + $points;
break;
case '2':
$tables[$value->tableid_score]['pointsLevel2'] = $tables[$value->tableid_score]['pointsLevel2'] + $points;
break;
case '3':
$tables[$value->tableid_score]['pointsLevel3'] = $tables[$value->tableid_score]['pointsLevel3'] + $points;
break;
}
}
}
$tiebreaks = array();
foreach ($tables as $key => $table) {
$tables[$key]['points'] = $tables[$key]['pointsLevel0'] + $tables[$key]['pointsLevel1'] + $tables[$key]['pointsLevel2'] + $tables[$key]['pointsLevel3'];
$tables[$key]['pointsLevel1'] = $tables[$key]['points'] - $tables[$key]['pointsLevel0'] - $tables[$key]['pointsLevel2'] - $tables[$key]['pointsLevel3'];
$tables[$key]['pointsLevel2'] = $tables[$key]['points'] - $tables[$key]['pointsLevel0'] - $tables[$key]['pointsLevel1'] - $tables[$key]['pointsLevel3'];
$tables[$key]['pointsLevel3'] = $tables[$key]['points'] - $tables[$key]['pointsLevel0'] - $tables[$key]['pointsLevel1'] - $tables[$key]['pointsLevel2'];
$tables[$key]['tiebreak'] = sprintf("%02d", $tables[$key]['points']) . sprintf("%02d", $tables[$key]['pointsLevel3']) . sprintf("%02d", $tables[$key]['pointsLevel2']) . sprintf("%02d", $tables[$key]['pointsLevel1']) . sprintf("%02d", $tables[$key]['tiebreaker']);
$tables[$key]['level2'] = false;
$tables[$key]['level3'] = false;
array_push($tiebreaks, $tables[$key]['tiebreak']);
}
$uniqueTiebreaks = array_unique(array_diff_assoc($tiebreaks, array_unique($tiebreaks)));
$ties = false;
foreach ($tables as $key => $table) {
if (in_array($tables[$key]['tiebreak'], $uniqueTiebreaks)) {
$ties = true;
$tables[$key]['tied'] = true;
} else {
$tables[$key]['tied'] = false;
}
}
$tables = collect($tables);
$tables = $tables->sortByDesc('tiebreak');
$tables->values()->all();
$tables = $tables->toArray();
$position = 1;
foreach ($tables as $key => $value) {
if ($position <= 10) {
$tables[$key]['level2'] = true;
}
if ($position <= 6) {
$tables[$key]['level3'] = true;
}
$position++;
}
// RANKING CALC END
$teamsCollection = Team::all();
$teams = array();
foreach ($teamsCollection as $key => $value) {
$teams[$value->id] = $value;
}
return view('quizranking')->with(['quiz' => $quiz, 'teams' => $teams, 'tables' => $tables, 'ties' => $ties]);
}
示例10: function
<?php
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
Route::get('/', function () {
// prelevo l'elenco delle squadre
$teams = \App\Team::all();
return view('home', ['teams' => $teams]);
});
Route::get('team/{slug}', function ($slug) {
// prelevo l'oggetto TEAM con la lista dei giocatori associati
$team = \App\Team::where('slug', '=', $slug)->firstOrFail();
return view('players', ['players' => $team->players]);
});
Route::get('player/{id}', function ($player_id) {
// prelevo tutte le informazioni del PLAYER con id=$player_id
$player = \App\Skills::where('player_id', $player_id)->firstOrFail();
return view('player_info', ['data' => $player]);
});
Route::get('fantateam', function () {
// prelevo l'elenco delle fanta-squadre
$teams = \App\Fantateam::all();
return view('fantateams', ['teams' => $teams]);
示例11: redirect
return redirect()->back();
// redirect back if current user tries to access another user
}
$user_info = UserInfo::where('user_id', $id)->first();
$user = User::findorfail($id);
return view('pages/edit', compact('user', 'user_info'));
});
Route::post('/users/{id}/edit', 'UserController@update');
// Password routes
Route::controllers(['password' => 'Auth\\PasswordController']);
// Admin routes - only accessible by admin user
Route::group(['middleware' => 'App\\Http\\Middleware\\AdminMiddleware'], function () {
Route::get('/admin', function () {
$users = User::all();
$users_info = UserInfo::all();
$numTeams = count(Team::all());
$nullteam = UserInfo::where('team_id', null)->first();
return view('admin.teams', compact('users_info', 'users', 'numTeams', 'nullteam'));
});
Route::post('/admin', 'AdminController@generate');
Route::get('/admin/generate', function () {
return view('admin.generate');
});
Route::get('/admin/users/{id}', function ($id) {
$user = User::findorfail($id);
$userinfo = UserInfo::findorfail($id);
$numTeams = count(Team::all());
return view('admin.user', compact('user', 'userinfo', 'numTeams'));
});
Route::post('/admin/users/{id}', 'AdminController@edit');
});
示例12: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$members = Team::all();
return view('pages.index-team', compact('members'));
}
示例13: ShowUsers
public function ShowUsers()
{
$usuarios = User::orderBy('id', 'desc')->paginate(5);
$teams = Team::all();
return view('admin/usuarios', ['usuarios' => $usuarios, "teams" => $teams]);
}
示例14: createMatch
/**
* Show the match create page.
*
* @return Response
*/
public function createMatch()
{
return view('match.create')->with('teams', Team::all());
}
示例15: downloadCSGL_Logos
public static function downloadCSGL_Logos()
{
$teams = Team::all();
foreach ($teams as $team) {
if ($team->logo == null || $team->logo == "no_logo_new.svg") {
$team->logo = $team['csgl_name'] . ".jpg";
Scraper::grab_image(DataLoader::$base_img_url . $team['csgl_name'] . ".jpg", "assets/images/teamlogos/" . $team['csgl_name'] . ".jpg");
$team->save();
}
}
}