本文整理汇总了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();
}
示例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!');
}
示例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');
}
示例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();
}
示例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'));
}
示例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);
}
});
}
示例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);
}
示例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'));
}
}
示例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');
}
}
示例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');
}
示例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);
}
}
}
示例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();
}
}
示例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());
}
示例14: addTeams
public function addTeams(Request $request)
{
$team = new Team($request->input());
$team->save();
return redirect('admin/team');
}
示例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 !');
}