本文整理汇总了PHP中app\Group::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Group::create方法的具体用法?PHP Group::create怎么用?PHP Group::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Group
的用法示例。
在下文中一共展示了Group::create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create
/**
* Show the form for creating a new resource.
*
* @return Response
*/
public function create(Request $request)
{
$data = Tool::removeSpace($request->all());
$validator = Validator::make($data, ["Nombre" => "required", "escenario" => "required"]);
$toArray = $validator->errors()->toArray();
if ($validator->fails()) {
return response()->json(['success' => false, 'errors' => $toArray]);
} else {
if ($data['id']) {
$group = Group::find($data['id']);
$group->name = $data['Nombre'];
$group->challenge_id = $data['Reto'];
$group->stage_id = $data['escenario'];
$group->active = $data['Estatus'];
$group->save();
return response()->json(['success' => true]);
} else {
$dataBuild = $this->buildGroup($data['Reto']);
if ($dataBuild) {
return response()->json(['success' => false, 'errors' => [0 => 'Ya no se pueden crear mas grupos para reto']]);
} else {
Group::create(['name' => $data['Nombre'], 'challenge_id' => $data['Reto'], 'stage_id' => $data['escenario']]);
return response()->json(['success' => true]);
}
}
}
}
示例2: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Group::create(["designation" => "Buraca02", "localization" => "Buraca", "creation_date" => "37262"]);
Group::create(["designation" => "Buraca04", "localization" => "Buraca", "creation_date" => "38333"]);
Group::create(["designation" => "Buraca08", "localization" => "Buraca", "creation_date" => "39425"]);
Group::create(["designation" => "Buraca12", "localization" => "Buraca", "creation_date" => "40965"]);
Group::create(["designation" => "Cacem10", "localization" => "Cacem", "creation_date" => "40195"]);
Group::create(["designation" => "Caparide07", "localization" => "Tires", "creation_date" => "39131"]);
Group::create(["designation" => "Entroncamento13", "localization" => "Entroncamento", "creation_date" => "41294"]);
Group::create(["designation" => "Laranjeiras09", "localization" => "Laranjeiras", "creation_date" => "39873"]);
Group::create(["designation" => "Lavradio07", "localization" => "Lavradio", "creation_date" => "41315"]);
Group::create(["designation" => "Loures10", "localization" => "Loures", "creation_date" => "40216"]);
Group::create(["designation" => "Madrona05 e Tires05", "localization" => "Madorna", "creation_date" => "38389"]);
Group::create(["designation" => "MtA10", "localization" => "MtA", "creation_date" => "40216"]);
Group::create(["designation" => "RM07", "localization" => "RM", "creation_date" => "39425"]);
Group::create(["designation" => "SDR03", "localization" => "SDR", "creation_date" => "37633"]);
Group::create(["designation" => "SDR10", "localization" => "SDR", "creation_date" => "40153"]);
Group::create(["designation" => "SJB08", "localization" => "SJB", "creation_date" => "39509"]);
Group::create(["designation" => "SJB12", "localization" => "SJB", "creation_date" => "40965"]);
Group::create(["designation" => "Tires05", "localization" => "Tires", "creation_date" => "38382"]);
Group::create(["designation" => "VN08", "localization" => "VN", "creation_date" => "39138"]);
Group::create(["designation" => "VN11", "localization" => "VN", "creation_date" => "40587"]);
Group::create(["designation" => "Cacem08", "localization" => "Cacem", "creation_date" => "25569"]);
Group::create(["designation" => "CAboboda14", "localization" => "Conceição da Aboboda", "creation_date" => "41672"]);
Group::create(["designation" => "SJB14", "localization" => "SJB", "creation_date" => "41665"]);
Group::create(["designation" => "VN14", "localization" => "VN", "creation_date" => "41679"]);
}
示例3: run
public function run()
{
$faker = Faker::create();
foreach (range(0, 30) as $index) {
Group::create(['name' => $faker->sentence(1), 'sport_id' => $faker->biasedNumberBetween(0, 10), 'description' => $faker->sentence(10)]);
}
}
示例4: postCreate
public function postCreate()
{
// get all input
$all_input = \Request::all();
error_log("CI " . json_encode($all_input));
// create group
$group = \App\Group::create($all_input);
// photo file input
$photo_posted = array_key_exists('photo', $all_input);
$photo_path = 'images/icons/default_group.png';
if ($photo_posted) {
$photo_path = 'images/uploads/groups/' . \Input::file('photo')->getClientOriginalName();
\Image::make(\Input::file('photo'))->fit(100)->save($photo_path);
}
$group->photo = $photo_path;
// attach user to group so that we can set him as a chairman
$user = \Auth::user();
$user->groups()->attach($group->id);
// set user as user chairman
$group->chairman_id = $user->id;
$group->meeting_weekday = (int) $all_input['meeting_weekday'];
$group->update();
error_log("CI " . json_encode($group));
return redirect("/groups/{$group->id}/update");
}
示例5: store
public function store(Request $request)
{
$this->validate($request, ['name' => 'required', 'description' => 'required']);
$group = $request->all();
Group::create($group);
return redirect('admin/dashboard/group');
}
示例6: store
public function store(Request $request)
{
$this->validate($request, ['name' => 'required|min:3', 'cropper_json' => 'required', 'inputBanner' => 'required|image']);
$user = Auth::user();
$file = $request->file('inputBanner');
$data = $request->input('cropper_json');
$data = json_decode(stripslashes($data));
$imageName = $user->id . str_random(20) . '.' . $file->getClientOriginalExtension();
$file->move(public_path() . '/img/files/' . $user->id . '/', $imageName);
$src = public_path() . '/img/files/' . $user->id . '/' . $imageName;
$real_name = $file->getClientOriginalName();
$size = $file->getClientSize() / (1024 * 1024);
//calculate the file size in MB
$img = Image::make($src);
$img->rotate($data->rotate);
$img->crop(intval($data->width), intval($data->height), intval($data->x), intval($data->y));
$img->resize(1036, null, function ($constraint) {
$constraint->aspectRatio();
});
$img->save($src, 90);
$user->usage->add(filesize(public_path() . '/img/files/' . $user->id . '/' . $imageName) / (1024 * 1024));
// storage add
$group = Group::create(['user_id' => $user->id, 'name' => $request->input('name'), 'banner' => $user->id . "/" . $imageName]);
$user->groups()->attach($group->id);
return redirect(route('profile.group.list'));
}
示例7: store
/**
* Store a newly created resource in storage.
* @return Response
* @internal param Request $request
*/
public function store()
{
$input = Request::all();
$group = Group::create($input);
$group->save();
return redirect('grupper');
}
示例8: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(StoreGroupRequest $request)
{
if (Gate::denies('create', Group::class)) {
abort(403);
}
Group::create(['group_name' => $request->group_name, 'assigned_barangay' => $request->assigned_barangay]);
return redirect('/group')->with('alert-success', 'The record has been saved!');
}
示例9: groupTable
private function groupTable()
{
Group::truncate();
$data = [['title' => 'Администратор', 'system' => true], ['title' => 'Пользователь', 'system' => false]];
foreach ($data as $v) {
Group::create($v);
}
}
示例10: run
public function run()
{
$faker = Faker::create();
$userIds = User::lists('id');
foreach (range(1, 20) as $index) {
Group::create(['user_id' => $faker->randomElement($userIds), 'username' => $faker->word . $index, 'name' => $faker->name, 'description' => $faker->paragraph(), 'email' => $faker->email . $index]);
}
}
示例11: run
public function run()
{
$groups = [['name' => 'Technical'], ['name' => 'Choir'], ['name' => 'Ushering']];
DB::table('groups')->delete();
foreach ($groups as $group) {
Group::create($group);
}
}
示例12: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Model::unguard();
$faker = Faker\Factory::create();
$tutors = Tutor::lists('id')->all();
for ($i = 0; $i < 20; $i++) {
$groups = Group::create(array('tutor_id' => $faker->unique()->randomElement($tutors), 'name' => $faker->unique()->word, 'description' => $faker->paragraph($nbSentences = 5)));
}
}
示例13: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Model::unguard();
// $this->call('UserTableSeeder');
Group::create(['id' => 'admin', 'name' => 'Admin']);
Group::create(['id' => 'user', 'name' => 'User']);
User::create(['username' => 'admin', 'name' => 'Sys Admin', 'password' => 'admin', 'email' => env('MAIL_DEFAULT_SYS_EMAIL')]);
Model::reguard();
}
示例14: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$faker = Faker\Factory::create('it_IT');
$utenti = $this->getUsersIDS();
for ($i = 1; $i <= 6; $i++) {
$group_name = $faker->sentence();
$group_slug = Str::slug($group_name);
Group::create(['group_name' => $group_name, 'group_slug' => $group_slug, 'group_avatar' => "avatar" . mt_rand(1, 6) . ".jpg", 'group_owner' => mt_rand(1, count($utenti)), 'active' => 1, 'created_at' => $faker->dateTimeThisYear($max = 'now')]);
}
}
示例15: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('groups')->delete();
Group::create(['group_id' => '1', 'name' => 'Mens Singles']);
Group::create(['group_id' => '2', 'name' => 'Womens Singles']);
Group::create(['group_id' => '3', 'name' => 'Mens Doubles']);
Group::create(['group_id' => '4', 'name' => 'Womens Doubles']);
Group::create(['group_id' => '5', 'name' => 'Mens Mixed Doubles']);
Group::create(['group_id' => '6', 'name' => 'Womens Mixed Doubles']);
}