本文整理汇总了PHP中app\Team::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Team::create方法的具体用法?PHP Team::create怎么用?PHP Team::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Team
的用法示例。
在下文中一共展示了Team::create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: team
public function team($id)
{
$faker = Faker::create();
for ($i = 1; $i <= $faker->numberBetween(24, 30); $i++) {
Team::create(['institution_id' => $faker->numberBetween('1', count(Institution::get())), 'name' => 'Team ' . $i, 'name_altered' => 'Team ' . $i, 'robot_name' => 'Robot ' . $i, 'gender' => $faker->randomElement(['MAS', 'FEM', 'MIX']), 'challenge_id' => $id, 'degree_id' => $faker->numberBetween('1', count(Degree::get()))]);
}
}
示例2: store
/**
* Store a newly created resource in storage.
*
* @param Request $request
* @return Response
*/
public function store(CreateTeamRequest $request)
{
// The request params are already been validated
// by CreateTeamRequest
$team = Team::create($request->all());
return $team;
}
示例3: run
/**
* [run description]
* @return [type] [description]
*/
public function run()
{
DB::table('teams')->delete();
$race = Db::table('races')->select('id')->first();
Team::create(array('name' => 'Schnell', 'race_id' => $race->id));
Team::create(array('name' => 'Ichi Ban', 'race_id' => $race->id));
Team::create(array('name' => 'Team Pizza', 'race_id' => $race->id));
Team::create(array('name' => 'Mostly New Guys', 'race_id' => $race->id));
Team::create(array('name' => 'Team Mongolia', 'race_id' => $race->id));
}
示例4: storeTeam
/**
* Store team action.
*
* @param Request $request
* @return Response
*/
public function storeTeam(Request $request)
{
$this->validate($request, $this->rules(), $this->messages());
// Get players to associate with the team
$players = $request->input('players', []);
$team = Team::create($request->all());
$team->players()->attach($players);
$request->session()->flash('message', sprintf('Team %s added!', $team->name));
return redirect()->route('team.list');
}
示例5: run
/**
* Fills teams table
*
*/
public function run()
{
$faker = Faker::create();
foreach (range(1, 10) as $index) {
$t = Team::create(['name' => $faker->name(), 'abbreviation' => $faker->realText(11), 'description' => $faker->realText(150)]);
$t->captain()->associate(User::first());
$t->members()->attach(User::first());
//set captain of all teams to first user
$t->save();
}
}
示例6: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
// This validates the information. All I'm doing right now is requiring the first and last name.
// You can add more if you'd like to. If it fails it will thrown an exception and send back
// to the that was sent from
// check out http://laravel.com/docs/5.1/validation#available-validation-rules
$this->validate($request, ['name' => 'required']);
// Make sure that the classes are imported on top of the file with the use in front.
// Player is the class and is used up top by doing. use App\Player;
Team::create($request->all());
// redirect helper function to send them after storing in database
return redirect('teams');
}
示例7: create
public function create(Request $request)
{
$r = Team::create(array('title' => $request->get('title'), 'intro' => $request->get('intro'), 'header' => $request->get('header'), 'allow_join' => $request->get('allow_join'), 'is_open' => $request->get('is_open'), 'tags' => $request->get('tags'), 'user_id' => \Auth::user()->id));
if ($r) {
$r2 = TeamMember::create(array('team_id' => $r->id, 'user_id' => \Auth::user()->id, 'role' => 0));
$r3 = TeamTrace::create(array('team_id' => $r->id, 'user_id' => \Auth::user()->id, 'act' => '创建了', 'target' => $r->title, 'type' => 0));
if ($r2 && $r3) {
$this->succeed(true);
} else {
$this->fail(true);
}
} else {
$this->fail(true);
}
}
示例8: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$input = $request->all();
// upload image - avatar
if (\Input::hasFile('avatar')) {
$file = \Input::file('avatar');
$imagename = 'cycling_passion_team_member' . time() . '_' . $file->getClientOriginalName();
$path = public_path('uploads/small/' . $imagename);
$image = \Image::make($file->getRealPath())->resize(200, 100)->save($path);
// fit invece di resize x ritagliare
$input['avatar'] = $imagename;
}
Team::create($input);
//return redirect()->back();
return redirect('/admin/teams')->with('message', 'Team Member created');
}
示例9: 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, ['photo' => 'required|image|max:2000', 'name' => 'required|min:5', 'position' => 'required', 'description' => 'required|min:30', 'description2' => 'required_with:description3']);
$member = [];
$photo = Input::file('photo');
if ($photo->isValid()) {
$ext = $photo->getClientOriginalExtension();
$destination = 'images';
$name = explode(' ', $request->input('name'));
$name = strtolower($name[0]);
$filename = $name . '.' . $ext;
$member['photo'] = $filename;
$photo->move($destination, $filename);
}
$member['name'] = strtolower($request->input('name'));
$member['position'] = strtolower($request->input('position'));
$member['description'] = $request->input('description');
$member['description2'] = trim($request->input('description2')) != "" ? trim($request->input('description2')) : null;
$member['description3'] = trim($request->input('description3')) != "" ? trim($request->input('description3')) : null;
Team::create($member);
return redirect('admin/team');
}
示例10: create
/**
* Create a new user instance after a valid registration.
*
* @param array $data
* @return User
*/
protected function create(array $data)
{
Team::create(['namateam' => $data['namateam'], 'kategori' => $data['kategori'], 'instansi' => $data['instansi'], 'alamatinstansi' => $data['alamatinstansi']]);
$team = Team::where('namateam', $data['namateam'])->first();
if ($data['kategori'] == 0) {
$max = 2;
$level = 0;
} else {
$max = 3;
$level = 0;
}
if (isset($data['anggota'])) {
$max = count($data['anggota']) > $max ? $max : count($data['anggota']);
$anggota = $data['anggota'];
for ($i = 0; $i < $max; $i++) {
User::create(['nama' => $anggota[$i]['nama'], 'email' => $anggota[$i]['email'], 'notelp' => $anggota[$i]['notelp'], 'idteam' => $team['id']]);
}
}
$user = User::create(['nama' => $data['namaketua'], 'email' => $data['emailketua'], 'password' => bcrypt($data['password']), 'notelp' => $data['notelp'], 'code' => str_random(30), 'level' => $level, 'idteam' => $team['id']]);
$user['kategori'] = $data['kategori'];
return $user;
}
示例11: addTeam
public function addTeam(Request $request)
{
$input = $request->all();
Team::create($input);
return redirect()->back();
}
示例12: store
/**
* Store a newly created resource in storage.
*
* @param App\Http\Requests\CreateTeamRequest $request
* @return \Illuminate\Http\Response
*/
public function store(CreateTeamRequest $request)
{
$team_name = $request->input('team_name');
Team::create([$team_name]);
return redirect(action('UserController@index'));
}
示例13: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('teams')->delete();
Team::create(['name' => 'Brave Heart', 'country' => 'China', 'region' => 'Asia', 'active' => true, 'created_on' => '2014-12-15', 'overview' => 'is a Chinese e-Sports organisation currently fielding teams in Starcraft 2, Heroes of the Storm, and Dota 2.']);
Team::create(['name' => 'CDEC Gaming', 'country' => 'China', 'region' => 'Asia', 'active' => true, 'created_on' => '2014', 'overview' => 'In October 2014, the former LGD Gaming "youth" squad LGD.CDEC left the LGD Gaming organization to establish an independent club called CDEC Gaming.']);
}
示例14: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Team::create(['name' => 'Test team']);
Team::create(['name' => 'NODE5 staff']);
}
示例15: create_new_team
/**
* Creates a new team and returns its id.
*
* @param string
* @return int
*/
private function create_new_team($team_name)
{
$team = Team::create(compact('team_name'));
return $team->team_id;
}