当前位置: 首页>>代码示例>>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;未经允许,请勿转载。