本文整理汇总了PHP中Team::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Team::where方法的具体用法?PHP Team::where怎么用?PHP Team::where使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Team
的用法示例。
在下文中一共展示了Team::where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Team
function team_get()
{
// check that the id is at least a valid number
$this->_check_id();
// get the single team by id
$team = new Team();
$team->where('id', $this->get('id'))->limit(1)->get();
if ($team->result_count() == 1) {
$result = $team->to_array();
$members = new Membership();
// get members gives an actual object with ->profile_othervariable
$memb = $members->get_members($team->id);
// we have to select the user array manually because... we don't want to expose password hashes
foreach ($memb->all as $key => $mem) {
$result['members'][$key] = $mem->to_array(array('id', 'username'));
$result['members'][$key]['display_name'] = $mem->profile_display_name;
$result['members'][$key]['twitter'] = $mem->profile_twitter;
$result['members'][$key]['bio'] = $mem->profile_bio;
}
// all good
$this->response($result, 200);
// 200 being the HTTP response code
} else {
// no team for this id
$this->response(array('error' => _('Team could not be found')), 404);
}
}
示例2: getteams
public function getteams()
{
$keyword = Input::get('q');
$teams = Team::where('name', 'like', '%' . $keyword . '%')->get();
$results = array();
if ($teams->count() > 0) {
foreach ($teams as $team) {
array_push($results, array('id' => $team->id, 'text' => $team->name));
}
}
$results = array('results' => $results);
return Response::json($results);
}
示例3: Team
function get_home_team() {
$CI = & get_instance();
if (isset($CI->fs_loaded->home_team))
return $CI->fs_loaded->home_team;
$hometeam = get_setting('fs_gen_default_team');
$team = new Team();
$team->where('name', $hometeam)->limit(1)->get();
if ($team->result_count() < 1) {
$team = new Team();
$team->limit(1)->get();
}
return $team;
}
示例4: add_joint_via_name
public function add_joint_via_name($teams)
{
$result = array();
foreach ($teams as $team) {
$tea = new Team();
$tea->where('name', $team)->get();
if ($tea->result_count() == 0) {
set_notice('error', _('One of the named teams doesn\'t exist.'));
log_message('error', 'add_joint_via_name: team does not exist');
return false;
}
$result[] = $tea->id;
}
return $this->add_joint($result);
}
示例5: Team
function team_get() {
if (!$this->get('id') || !is_numeric($this->get('id'))) {
$this->response(NULL, 400);
}
$team = new Team();
$team->where('id', $this->get('id'))->limit(1)->get();
if ($team->result_count() == 1) {
$result = $team->to_array();
$members = new Membership();
$memb = $members->get_members($team->id);
foreach($memb->all as $key => $mem) {
$result['members'][$key] = $memb->to_array(array('id','username'));
$result['members'][$key]['display_name'] = $memb->profile_display_name;
$result['members'][$key]['twitter'] = $memb->profile_twitter;
$result['members'][$key]['bio'] = $memb->profile_bio;
}
$this->response($result, 200); // 200 being the HTTP response code
} else {
$this->response(array('error' => _('Team could not be found')), 404);
}
}
示例6: Team
function team_get() {
if (!$this->get('id') || !is_numeric($this->get('id'))) {
$this->response(NULL, 400);
}
if (!$this->get('page') || !is_numeric($this->get('page')) || $this->get('page') < 1)
$page = 1;
else
$page = (int) $this->get('page');
$page = ($page * 100) - 100;
$team = new Team();
$team->where('id', $this->get('id'))->limit(1)->get();
if ($team->result_count() == 1) {
$result = array();
$result['team'] = $team->to_array();
// get joints to get also the chapters from joints
$joints = new Joint();
$joints->where('team_id', $team->id)->get();
$chapters = new Chapter();
$chapters->where('team_id', $team->id);
foreach ($joints->all as $joint) {
$chapters->or_where('joint_id', $joint->joint_id);
}
$chapters->limit(100, $page)->get();
$chapters->get_comic();
$result['chapters'] = array();
foreach ($chapters->all as $key => $chapter) {
if (!$chapter->team_id) {
$chapter->get_teams();
foreach ($chapter->teams as $item) {
$result['chapters'][$key]['teams'][] = $item->to_array();
}
} else {
$result['chapters'][$key]['teams'][] = $team->to_array();
}
$result['chapters'][$key]['comic'] = $chapter->comic->to_array();
$result['chapters'][$key]['chapter'] = $chapter->to_array();
}
$this->response($result, 200); // 200 being the HTTP response code
} else {
$this->response(array('error' => _('Team could not be found')), 404);
}
}
示例7: teamName
public function teamName($team_id)
{
$team_info = Team::where('id', '=', $team_id)->first();
$team_name = $team_info->team_title;
return $team_name;
}
示例8: get_teams
public function get_teams($team_id, $joint_id = 0)
{
// if it's a joint, let's deal it as a joing
if ($joint_id > 0) {
// get all the joint entries so we have all the teams
$joint = new Joint();
$joint->where("joint_id", $joint_id)->get();
// not an existing joint?
if ($joint->result_count() < 1) {
log_message('error', 'get_teams: joint -> joint not found');
return false;
}
// result array
$teamarray = array();
foreach ($joint->all as $key => $join) {
if (!($team = $this->get_cached($join->team_id))) {
$team = new Team();
$team->where('id', $join->team_id);
$team->get();
}
$teamarray[] = $team->get_clone();
}
if (empty($teamarray)) {
log_message('error', 'get_teams: joint -> no teams found');
return false;
}
return $teamarray;
}
// if we're here, it means it's a simple team
if (!($team = $this->get_cached($team_id))) {
$team = new Team($team_id);
}
return array($team);
}
示例9: Team
function get_setting_facebook($team = NULL)
{
$hometeam = get_setting('fs_gen_default_team');
$team = new Team();
$team->where('name', $hometeam)->limit(1)->get();
return $team->facebook;
}
示例10: download
public function download($comic, $language = 'en', $volume = 0, $chapter = "", $subchapter = 0, $team = 0, $joint = 0, $pagetext = 'page', $page = 1) {
if(!get_setting('fs_dl_enabled'))
show_404();
$comice = new Comic();
$comice->where('stub', $comic)->get();
if ($comice->result_count() == 0) {
set_notice('warn', 'This comic doesn\'t exist.');
}
if ($chapter == "") {
redirect('/reader/comic/' . $comic);
}
$chaptere = new Chapter();
$chaptere->where('comic_id', $comice->id)->where('language', $language)->where('volume', $volume)->where('chapter', $chapter)->order_by('subchapter', 'ASC');
if (!is_int($subchapter) && $subchapter == 'page') {
$current_page = $team;
}
else {
$chaptere->where('subchapter', $subchapter);
if ($team == 'page')
$current_page = $joint;
else {
if ($team != 0) {
$teame = new Team();
$teame->where('stub', $team)->get();
$chaptere->where('team_id', $teame->id);
}
if ($joint == 'page')
$current_page = $pagetext;
if ($joint != 0) {
$chaptere->where('joint_id', $joint);
}
}
}
if (!isset($current_page)) {
if ($page != 1)
$current_page = $page;
else
$current_page = 1;
}
$chaptere->get();
if ($chaptere->result_count() == 0) {
show_404();
}
$archive = new Archive();
$url = $archive->compress($chaptere);
redirect($url);
}
示例11: postStepThree
public function postStepThree()
{
$code = Input::get('code');
$validation = Validator::make(['teamname' => Input::get('teamname')], ['teamname' => 'required|max:20|min:4']);
if ($validation->fails()) {
return Redirect::route('setprofile_step3', array($code))->withErrors($validation)->withInput(Input::except('_token'));
} else {
$teamname = Input::get('teamname');
try {
$userQuery = User::where('code', '=', $code)->first();
$creatorID = $userQuery->id;
$orgIDQuery = DB::table('organizations')->where('creator_id', '=', $creatorID)->first();
$orgID = $orgIDQuery->id;
if ($userQuery && $orgIDQuery) {
$team = new Team();
$team->team_title = $teamname;
$team->leader_id = $creatorID;
$team->org_id = $orgID;
$team->save();
$teamQuery = Team::where('team_title', '=', $teamname)->first();
$teamID = $teamQuery->id;
$userQuery->team_id = $teamID;
$userQuery->save();
return Redirect::route('setprofile_step4', array($code));
} else {
return 'Cant Find User';
}
} catch (Exception $e) {
return Redirect::route('setprofile_step3', array($code));
}
}
}
示例12: addplayer
public function addplayer($id)
{
setlocale(LC_MONETARY, "en_US");
$user = Auth::user();
$club = $user->Clubs()->FirstOrFail();
$followers = new Follower();
$title = 'League Together - ' . $club->name . ' Teams';
$team = Team::where("id", "=", $id)->where("club_id", '=', $club->id)->FirstOrFail();
$plan = $club->plans()->lists('name', 'id');
return View::make('pages.user.club.team.addplayer')->with('page_title', $title)->with('team', $team)->with('followers', $followers->getPlayers())->withUser($user);
}
示例13: edit
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
//
$teams = Team::where('id', $id)->get();
return view('admin/edit_team')->withTeam($teams);
}
示例14: Membership
/**
* Returns leader team objects, false in case user is not a team leader
*
* @author Woxxy
* @param int $team_id if NULL returns each team in which this user is leader
* @return object Teams
*
*/
function is_team_leader($team_id = NULL) {
if (!$this->is_logged_in())
return FALSE;
$leaderships = new Membership();
$leaderships->where('user_id', $this->get_user_id())->where('accepted', 1)->where('is_leader', 1);
if (is_numeric($team_id)) {
$leaderships->where('team_id', $team_id);
$leaderships->get();
if ($leaderships->result_count() != 1)
return FALSE;
$team = new Team();
$team->where('id', $team_id)->get();
return $team;
}
$leaderships->get();
if ($leaderships->result_count() < 1)
return FALSE;
$teams = new Team();
// Notice that if you remove the result count on $leaderships, this will not run and the user will be leader of any team!
foreach ($leaderships->all as $key => $leadership) {
$teams->or_where('id', $leadership->team_id);
}
$teams->get();
return $teams;
}
示例15: edit
/**
* Show the form for editing the specified resource.
* GET /members/{id}/edit
*
* @param int $id
* @return Response
*/
public function edit($team, $id)
{
setlocale(LC_MONETARY, "en_US");
$user = Auth::user();
$club = $user->Clubs()->FirstOrFail();
$member = Member::find($id);
$title = 'League Together - ' . $club->name . ' Teams';
$team = Team::where("id", "=", $team)->where("club_id", '=', $club->id)->FirstOrFail();
return View::make('app.club.member.edit')->with('page_title', $title)->with('team', $team)->with('member', $member)->with('club', $club)->withUser($user);
}