當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Team::save方法代碼示例

本文整理匯總了PHP中app\Team::save方法的典型用法代碼示例。如果您正苦於以下問題:PHP Team::save方法的具體用法?PHP Team::save怎麽用?PHP Team::save使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在app\Team的用法示例。


在下文中一共展示了Team::save方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: save

 public function save($data1, $data2)
 {
     $team = new Team();
     $team->name = $data1;
     $team->nbplayers = $data2;
     $team->save();
 }
開發者ID:vinceApp,項目名稱:Soccerteam-App,代碼行數:7,代碼來源:TeamRepository.php

示例2: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $this->validate($request, ['txtName' => 'required', 'staff' => 'required', 'rActive' => 'required|in:0,1']);
     $team = new Team();
     // is manager
     // insert team type Manager
     if (Gate::allows('check-manager')) {
         $team->type = 'Manager';
     }
     // is leader
     // insert team type Leader
     if (Gate::allows('check-leader')) {
         $team->type = 'Leader';
     }
     $team->active = $request->rActive;
     $team->name = $request->txtName;
     $team->creator = Auth::user()->id;
     $team->save();
     foreach ($request->staff as $value) {
         $staffTeam = new StaffTeam();
         $staffTeam->staff_id = $value;
         $staffTeam->team_id = $team->id;
         $staffTeam->save();
     }
     return redirect()->route('admin.team.index')->with('message', 'Create team success!');
 }
開發者ID:dinhtich1991,項目名稱:staff,代碼行數:32,代碼來源:TeamController.php

示例3: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $team = new Team();
     if ($team->save()) {
         \Auth::user()->team_id = $team->id;
         \Auth::user()->save();
     }
     return redirect()->action('TeamsController@show');
 }
開發者ID:axsauze,項目名稱:SDHacks,代碼行數:14,代碼來源:TeamsController.php

示例4: create

 public function create(Request $request)
 {
     $this->validate($request, ['name' => 'required', 'color' => 'required']);
     $team = new Team();
     $team->name = $request->input('name');
     $team->color = strtolower($request->input('color'));
     $team->save();
     return $this->response();
 }
開發者ID:jamiehoward,項目名稱:scavenger,代碼行數:9,代碼來源:TeamController.php

示例5: postNew

 public function postNew()
 {
     $validator = Team::validateAll(Input::all());
     if ($validator->fails()) {
         Input::flash();
         return redirect()->route('team.new')->withErrors($validator->messages()->all());
     }
     $team = new Team();
     $team->name = Input::get('name');
     $team->description = Input::get('description');
     $team->save();
     return redirect()->route('team.new')->with('success', trans('app.newTeamSuccess'));
 }
開發者ID:jubi4dition,項目名稱:teammanager-basic,代碼行數:13,代碼來源:TeamController.php

示例6: boot

 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);
         }
     });
 }
開發者ID:kharhys,項目名稱:revenue,代碼行數:15,代碼來源:User.php

示例7: 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);
 }
開發者ID:leloulight,項目名稱:RealMadrid,代碼行數:16,代碼來源:TeamsController.php

示例8: store

 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'));
     }
 }
開發者ID:elvinas21,項目名稱:BasketballFantasyLeague,代碼行數:17,代碼來源:TeamController.php

示例9: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $rules = array('name' => 'required');
     $validator = Validator::make(Input::all(), $rules);
     // process the login
     if ($validator->fails()) {
         return Redirect::to('teams/create')->withErrors($validator);
     } else {
         // store
         $team = new Team();
         $team->name = Input::get('name');
         $team->description = Input::get('description');
         $team->user_id = Auth::user()->id;
         $team->save();
         $team->projects()->attach($request->input('project_list'));
         // redirect
         Session::flash('message', 'Successfully created team!');
         return Redirect::to('user/teams');
     }
 }
開發者ID:pagegwood,項目名稱:timetracker,代碼行數:26,代碼來源:TeamsController.php

示例10: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     $team = new Team();
     $team->name = $request->get('name');
     $team->slug = $this->generateSlug($team->name);
     $team->email = $request->get('email');
     $team->phone = $request->get('phone');
     $team->save();
     $playersArray = $request->get('players');
     $i = 0;
     $players = null;
     foreach ($playersArray as $p) {
         $players[$i] = new Player();
         $players[$i]->name = $p;
         $players[$i]->team_id = $team->id;
         $i++;
     }
     $team->players()->saveMany($players);
     return redirect('teams');
 }
開發者ID:ViktorLalev,項目名稱:smolyancup,代碼行數:26,代碼來源:TeamsController.php

示例11: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     for ($i = 0; $i < 10; $i++) {
         $faker = Faker\Factory::create();
         $team = new Team();
         $team->name = $faker->company;
         $team->slug = $faker->slug;
         //slug
         $team->email = $faker->email;
         //email
         $team->phone = $faker->phoneNumber;
         //phoneNumber
         $team->save();
         for ($i = 0; $i < 10; $i++) {
             $player = new Player();
             $player->name = $faker->name('male');
             $player->team_id = $team->id;
             $team->players()->save($player);
         }
     }
 }
開發者ID:ViktorLalev,項目名稱:smolyancup,代碼行數:26,代碼來源:TeamsDbSeeder.php

示例12: loadFromJSONtoDB

 public static function loadFromJSONtoDB()
 {
     $content = file_get_contents('assets/json/teams.json');
     $teams = json_decode($content, true);
     var_dump($teams);
     foreach ($teams as $team) {
         $t = new Team();
         $t->csgl_name = $team['csgl_name'];
         $t->hltv_name = $team['hltv_name'];
         $t->hltv_url = $team['hltv_url'];
         $t->logo = $team['logo'];
         $t->save();
     }
 }
開發者ID:pavelmalai,項目名稱:virtualcsgo,代碼行數:14,代碼來源:DataLoader.php

示例13: 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

示例14: addTeams

 public function addTeams(Request $request)
 {
     $team = new Team($request->input());
     $team->save();
     return redirect('admin/team');
 }
開發者ID:DanielAlxx,項目名稱:MOJ,代碼行數:6,代碼來源:AdminController.php

示例15: AddTeam

 public function AddTeam(Request $request)
 {
     // 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/' . $request->input('id_project'));
     }
     // End Check Authorization
     // Validation //
     $validation = Validator::make($request->all(), ['name' => 'required|max:255']);
     // Check if it fails //
     if ($validation->fails()) {
         return redirect()->back()->withInput()->with('errors', $validation->errors());
     }
     $author = Auth::user()->id;
     $team = new Team();
     $team->name = $request->input('name');
     $team->status = 1;
     $team->id_projects = $request->input('id_project');
     $team->save();
     Alert::success('Berhasil menambahkan team  ' . $request->input('name') . ' !')->persistent("Close");
     return redirect('project/view/' . $request->input('id_project'))->with('message', 'You just uploaded !');
 }
開發者ID:arisros,項目名稱:drope.mployee,代碼行數:34,代碼來源:ProjectController.php


注:本文中的app\Team::save方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。