当前位置: 首页>>代码示例>>PHP>>正文


PHP Team::find方法代码示例

本文整理汇总了PHP中app\Team::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Team::find方法的具体用法?PHP Team::find怎么用?PHP Team::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\Team的用法示例。


在下文中一共展示了Team::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: destroy

 /**
  * Destroy the given team.
  *
  * @param  Request  $request
  * @param  Team  $team
  * @return Response
  */
 public function destroy(Request $request, $team)
 {
     $this->teamRepo->isTeamForUser($request->user(), $team);
     $teamDelete = Team::find($team);
     if (!$teamDelete) {
         abort(404);
     }
     $this->authorize('destroy', $teamDelete);
     $teamDelete->delete();
     return redirect()->route('teams.index')->with('status', 'success')->with('message', 'Equipo eliminado correctamente. ¿No te gustaba?, ¿Estaba mal creado? Espero que nos ayudes');
 }
开发者ID:gorkaeff,项目名称:escudosfutbol,代码行数:18,代码来源:TeamController.php

示例2: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($team_id)
 {
     $team = Team::find($team_id);
     if (!$team) {
         abort(404);
     }
     $message = "" . $team->name . " ha dejado de ser un equipo favorito. ¿Por qué?";
     session_start();
     $registro = Rating::where('team_id', '=', $team_id)->where('session', '=', $_SESSION["session"])->get();
     $registro[0]->delete();
     return redirect()->route('welcome')->with('status', 'danger')->with('message', $message);
 }
开发者ID:gorkaeff,项目名称:escudosfutbol,代码行数:18,代码来源:RatingController.php

示例3: addPoints

 public function addPoints(Request $request, $id)
 {
     $this->validate($request, ['amount' => 'required|numeric']);
     $team = Team::find($id);
     foreach ($team->users as $user) {
         $points = new \App\Point();
         $points->user_id = $user->id;
         $points->amount = $request->input('amount');
         $points->note = $request->input('note');
         $points->save();
     }
     return $this->response();
 }
开发者ID:jamiehoward,项目名称:scavenger,代码行数:13,代码来源:TeamController.php

示例4: isTeamForUser

 public function isTeamForUser(User $user, $team_id)
 {
     $equipo = Team::find($team_id);
     if (!$equipo) {
         abort(404);
     }
     if ($user->role === 'app_admin') {
         return true;
     }
     if ($equipo->user->id === $user->id) {
         return true;
     } else {
         //unauthorized
         abort(401);
     }
 }
开发者ID:gorkaeff,项目名称:escudosfutbol,代码行数:16,代码来源:TeamRepository.php

示例5: Show

 public function Show($id, $libdivision)
 {
     $team = Team::find($id);
     if ($team != null && str_slug($team->libdivision) == $libdivision) {
         $tableau = array();
         $libelle = '';
         foreach ($team->Rounds as $round) {
             if (isset($tableau[$round->libelle])) {
                 $tableau[$round->libelle][] = $round;
             } else {
                 $tableau[$round->libelle] = array($round);
             }
         }
         return view('front.championship.show', array('rounds' => $tableau, 'ranks' => $team->Ranks));
     } else {
         abort(404);
     }
 }
开发者ID:kbiyo,项目名称:ARTTv2,代码行数:18,代码来源:ChampionshipController.php

示例6: index

 /**
  * Show the application dashboard to the user.
  *
  * @return Response
  */
 public function index()
 {
     $title = "Dashboard";
     if (Auth::user()->role_id == 4) {
         $model = Department::with(['user', 'developer', 'leader', 'manager'])->get();
         return view('html.dashboard.admin', compact('title', 'model'));
     } elseif (Auth::user()->role_id == 3) {
         return view('html.dashboard.manager', compact('title', 'model'));
     } elseif (Auth::user()->role_id == 2) {
         $list = \App\Team::where('created_user_id', Auth::user()->id)->with('detail')->first();
         return view('html.dashboard.leader', compact('title', 'list'));
     } else {
         $var = \App\TeamDetail::select('team_id')->where('staff_id', Auth::user()->id)->first();
         $bol = "";
         if ($var != null) {
             $team = \App\Team::find($var->team_id);
             $leader = User::find($team->created_user_id);
             $bol = "true";
             $list = \App\TeamDetail::select('*')->where('staff_id', '<>', Auth::user()->id)->where('team_id', $var->team_id)->get();
         }
         return view('html.dashboard.developer', compact('title', 'list', 'bol', 'leader'));
     }
 }
开发者ID:trongtri0705,项目名称:staff,代码行数:28,代码来源:HomeController.php

示例7: destroy

 public function destroy($id, $user)
 {
     $team = Team::find($id);
     if ($team->created_user_id != Auth::user()->id) {
         return view('html.error-403');
     }
     \App\TeamDetail::where(['team_id' => $id, 'staff_id' => $user])->delete();
     return redirect()->route('admin.team.index')->with('success', 'successfully deleted');
 }
开发者ID:trongtri0705,项目名称:elinext_project,代码行数:9,代码来源:ManagerController.php

示例8: postNewAnggota

 public function postNewAnggota(UpdateAnggotaRequest $request)
 {
     $team = Team::find($request['id']);
     User::create(['nama' => $request['nama'], 'email' => $request['email'], 'notelp' => '62' . $request['notelp'], 'idteam' => $request['id']]);
     return redirect('admin/team/anggota/' . $request['id'])->with('status', 'Anggota sudah di tambah');
 }
开发者ID:notreal5400,项目名称:Vocomfest2016,代码行数:6,代码来源:AdminController.php

示例9: team2

 /**
  * Get the team2 of a match.
  * @return App/Team
  */
 public function team2()
 {
     return Team::find($this->team2_id);
 }
开发者ID:jpmartinspt,项目名称:table-soccer-tracker,代码行数:8,代码来源:Match.php

示例10: applyToCourse

 public function applyToCourse(Request $request)
 {
     $this->validate($request, ['team' => 'required|integer|exists:teams,id', 'course' => 'required|integer|exists:courses,id']);
     $team = Team::find($request->input('team'));
     $course = Course::find($request->input('course'));
     $team->courses()->attach($course);
     Session::flash('success', "Your team applied to {$course->name}");
     return redirect()->back();
 }
开发者ID:BootySYS,项目名称:bootysys,代码行数:9,代码来源:TeamsController.php

示例11: initTeam

 public function initTeam()
 {
     $intPlayerId = Input::get('player_id', 0);
     // 目前已经生成Team数量确认
     /* 玩家可用Team数量确认
      * Lv.1 ~ Lv.10   1Team
      * Lv.11 ~ Lv.20  2Team
      * Lv.21 ~ Lv.50  3Team
      * Lv.51 ~ Lv.100 4Team
      * 氪金玩家        +1Team
      */
     $objTeam = new Team();
     $objTeam->player_id = $intPlayerId;
     $objTeam->team_no = 1;
     // 该用户的第一个队伍
     $objTeam->team_name = "Team01";
     $firstCard = OwnedCard::where('player_id', $intPlayerId)->orderBy('id', 'ASC')->first();
     $objTeam->position_1_owned_card_id = $firstCard->id;
     $objTeam->total_cost = $firstCard->getCost();
     $objTeam->save();
     $objTeamBk = Team::find($objTeam->id);
     // 20151012 TeamMember Table 初始化
     for ($intPosition = 1; $intPosition <= 6; $intPosition++) {
         $objTeamMember = new TeamMember();
         $objTeamMember->team_id = $objTeamBk->id;
         $objTeamMember->position = $intPosition;
         $objTeamMember->player_id = $objTeamBk->player_id;
         if ($intPosition == 1) {
             $objTeamMember->card_id = $firstCard->card_id;
             $objTeamMember->owned_card_id = $firstCard->id;
         }
         $objTeamMember->save();
         switch ($intPosition) {
             case 1:
                 $objTeamBk->position_1_member_id = $objTeamMember->id;
                 break;
             case 2:
                 $objTeamBk->position_2_member_id = $objTeamMember->id;
                 break;
             case 3:
                 $objTeamBk->position_3_member_id = $objTeamMember->id;
                 break;
             case 4:
                 $objTeamBk->position_4_member_id = $objTeamMember->id;
                 break;
             case 5:
                 $objTeamBk->position_5_member_id = $objTeamMember->id;
                 break;
             case 6:
                 $objTeamBk->position_6_member_id = $objTeamMember->id;
                 break;
             default:
                 # code...
                 break;
         }
         // 20151103 追加
         $firstCard->team_id = $objTeam->id;
         $firstCard->save();
     }
     $objTeamBk->save();
     return Response::json($objTeamBk->toArray());
 }
开发者ID:kakitsubun,项目名称:wc-test,代码行数:62,代码来源:TeamController.php

示例12: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $team = Team::find($id);
     $path = $team->logo_path;
     $name = $team->logo_name;
     $file = $path . $name;
     if (\File::isFile($file)) {
         \File::delete($file);
     }
     $team->delete();
     flash()->success('', 'Komanda ištrinta!');
     return Redirect::to('/dashboard/teams/');
 }
开发者ID:leloulight,项目名称:RealMadrid,代码行数:19,代码来源:TeamsController.php

示例13: firstTeam

 /**
  * 玩家创建时初始化第一套队伍
  */
 public function firstTeam()
 {
     // Transaction
     DB::beginTransaction();
     try {
         $objTeam = new Team();
         $intPlayerId = $this->id;
         $objTeam->player_id = $intPlayerId;
         $objFirstCard = OwnedCard::where('player_id', $intPlayerId)->orderBy('id', 'ASC')->first();
         $objTeam->position_1_owned_card_id = $objFirstCard->id;
         $objTeam->total_cost = $objFirstCard->getCost();
         $objTeam->save();
         // TODO 是否需要
         $objTeamBk = Team::find($objTeam->id);
         // 20151012 TeamMember Table 初始化
         for ($intPosition = 1; $intPosition <= 6; $intPosition++) {
             $objTeamMember = new TeamMember();
             $objTeamMember->team_id = $objTeamBk->id;
             $objTeamMember->position = $intPosition;
             $objTeamMember->player_id = $objTeamBk->player_id;
             if ($intPosition == 1) {
                 $objTeamMember->card_id = $objFirstCard->card_id;
                 $objTeamMember->owned_card_id = $objFirstCard->id;
             }
             if (!$objTeamMember->save()) {
                 throw new Exception('Save Failed');
             }
             switch ($intPosition) {
                 case 1:
                     $objTeamBk->position_1_member_id = $objTeamMember->id;
                     break;
                 case 2:
                     $objTeamBk->position_2_member_id = $objTeamMember->id;
                     break;
                 case 3:
                     $objTeamBk->position_3_member_id = $objTeamMember->id;
                     break;
                 case 4:
                     $objTeamBk->position_4_member_id = $objTeamMember->id;
                     break;
                 case 5:
                     $objTeamBk->position_5_member_id = $objTeamMember->id;
                     break;
                 case 6:
                     $objTeamBk->position_6_member_id = $objTeamMember->id;
                     break;
             }
             // 更新玩家卡片的队伍信息
             $objFirstCard->team_id = $objTeam->id;
             if (!$objFirstCard->save()) {
                 throw new Exception('Save Failed');
             }
         }
         if (!$objTeamBk->save()) {
             throw new Exception('Save Failed');
         }
         DB::commit();
     } catch (Exception $e) {
         // TODO Dev Log
         DB::rollback();
     }
 }
开发者ID:kakitsubun,项目名称:wc-test,代码行数:65,代码来源:Player.php

示例14: DelTeam

 public function DelTeam($id, $id_team)
 {
     // Start Check Authorization
     /**
      * 1. FullAccess - 1
      * 2. HRD - 3
      * 3. Creator - 5
      * 4. Handler - 7
      */
     $invalid_auth = 1;
     $authRole = Auth::user()->UserRoles->role;
     if ($authRole == 7 or $authRole == 1 or $authRole == 3) {
         $invalid_auth = 0;
     }
     if ($invalid_auth == 1) {
         Alert::error('Anda tidak memilik akses ini')->persistent('close');
         return redirect('project/view/' . $id);
     }
     // End Check Authorization
     $db = Team::find($id_team);
     $db->status = 0;
     $db->save();
     $now = date('Y-m-d');
     foreach ($db->tl as $tl) {
         $db_tl = Teamleader::find($tl->id);
         $db_tl->status = 0;
         $db_tl->end = $now;
         $db_tl->save();
     }
     foreach ($db->store as $store) {
         $db_st = Store::find($store->id);
         $db_st->status = 0;
         $db_st->save();
         foreach ($store->members as $gm) {
             $db_gm = Member::find($gm->id);
             $db_gm->status = 0;
             $db_gm->end = $now;
             $db_gm->save();
             foreach ($gm->get_users as $gu) {
                 if ($gm->status == 1) {
                     $db_em = Employee::find($gu->id);
                     $db_em->status = 0;
                     $db_em->save();
                 }
             }
         }
     }
     Alert::success('Berhasil menonaktifkan !')->persistent("Close");
     return redirect('project/view/' . $id)->with('message', 'Stop Team Success!');
 }
开发者ID:arisros,项目名称:drope.mployee,代码行数:50,代码来源:ProjectController.php

示例15: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     //
     $team = Team::find($id);
     $team->delete();
     Session::flash('message', 'Successfully deleted your team.');
     return Redirect::to('user/teams');
 }
开发者ID:pagegwood,项目名称:timetracker,代码行数:14,代码来源:TeamsController.php


注:本文中的app\Team::find方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。