当前位置: 首页>>代码示例>>PHP>>正文


PHP Group::create方法代码示例

本文整理汇总了PHP中app\models\Group::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Group::create方法的具体用法?PHP Group::create怎么用?PHP Group::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\models\Group的用法示例。


在下文中一共展示了Group::create方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: store

 /**
  * Store a new group from form request
  *
  * @param Request $request
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  */
 public function store(Request $request)
 {
     $this->authorize('edit_users');
     $this->validate($request, ['name' => 'required|string|between:3,50', 'description' => 'string|between:0,100', 'permission_list' => 'array']);
     $group = Group::create($request->all());
     $group->permissions()->attach($request->input('permission_list'));
     flash()->success('Group Saved', 'The group has been created');
     return redirect('group');
 }
开发者ID:buys-fran,项目名称:mtech-mis,代码行数:15,代码来源:GroupsController.php

示例2: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store($society, GroupsRequest $request)
 {
     $group = Group::create($request->except('centrelat', 'centrelong', 'files'));
     $group->publish = $request->input('publish', false);
     $group->save();
     $indiv = Individual::find($request->input('contact'));
     $group->individual()->save($indiv);
     $update = Group::find($group->id)->individual()->updateExistingPivot($request->input('contact'), array('created_at' => DB::raw('NOW()')));
     return Redirect::route('society.groups.index', $society)->with('okmessage', 'New group has been added');
 }
开发者ID:bishopm,项目名称:circuit,代码行数:15,代码来源:GroupsController.php

示例3: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(GroupRequest $request)
 {
     $input = $request->all();
     $newpermission = false;
     $permissions = $request->get('permissions');
     $newpermission = static::format_per($permissions);
     $input['permissions'] = !empty($newpermission) ? json_encode($newpermission) : '';
     Group::create($input);
     Session::flash('success', Lang::get('ruban.group.created'));
     return Redirect::route('ruban.groups.index');
 }
开发者ID:mahitiinfo,项目名称:rubanbridge,代码行数:16,代码来源:GroupController.php

示例4: run

 public function run()
 {
     DB::statement('TRUNCATE TABLE t_px_group CASCADE');
     $group = Group::create(array('name' => '超级管理员'));
     $group->permissions()->sync(['setting.edit', 'user.add', 'user.edit', 'user.show', 'user.list', 'user.save', 'user.update', 'user.delete', 'user.reset', 'user.change', 'user.saveChange', 'user.profile', 'group.add', 'group.edit', 'group.show', 'group.list', 'group.save', 'group.update', 'group.delete', 'group.grant', 'group.saveGrant', 'permission.add', 'permission.edit', 'permission.show', 'permission.list', 'permission.save', 'permission.update', 'permission.delete', 'pjzb.add', 'pjzb.edit', 'pjzb.show', 'pjzb.list', 'pjzb.save', 'pjzb.update', 'pjzb.delete', 'pjbz.add', 'pjbz.edit', 'pjbz.show', 'pjbz.list', 'pjbz.save', 'pjbz.update', 'pjbz.delete', 'pfdj.add', 'pfdj.edit', 'pfdj.show', 'pfdj.list', 'pfdj.save', 'pfdj.update', 'pfdj.delete', 'pfjg.monitor', 'pfjg.departmentMonitor', 'pfjg.statistics', 'pfjg.departmentStatistics', 'pfjg.majorStatistics', 'pfjg.exportMonitor', 'pfjg.exportDepartmentMonitor', 'pfjg.exportStatistics', 'pfjg.exportDepartmentStatistics', 'pfjg.exportMajorStatistics']);
     $group = Group::create(array('name' => '年级辅导员'));
     $group->permissions()->sync(['user.change', 'user.saveChange', 'user.profile', 'pfjg.majorStatistics', 'pfjg.exportMajorStatistics']);
     $group = Group::create(array('name' => '教学秘书'));
     $group->permissions()->sync(['user.change', 'user.saveChange', 'user.profile', 'pfjg.departmentMonitor', 'pfjg.exportDepartmentMonitor', 'pfjg.departmentStatistics', 'pfjg.exportDepartmentStatistics']);
     $group = Group::create(array('name' => '学校领导'));
     $group->permissions()->sync(['user.change', 'user.saveChange', 'user.profile', 'pfjg.statistics', 'pfjg.exportStatistics']);
 }
开发者ID:rxfu,项目名称:jspx,代码行数:12,代码来源:GroupTableSeeder.php

示例5: create

 /**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function create(Request $request)
 {
     //
     if ($request->isMethod('get')) {
         return view('admin.group.create');
     }
     $groupname = $request->input('groupname', null);
     if (empty($groupname)) {
         session()->flash('msg_error', '请输入组名');
         return back();
     }
     $oGroup = Group::create(['name' => $groupname]);
     Admin::join_group($oGroup->id, session('admin_id'));
     session()->flash('msg_success', '创建成功,请分配权限');
     return redirect(route('admin::group.edit', [$oGroup->id]));
 }
开发者ID:smartgirl001,项目名称:Test,代码行数:21,代码来源:GroupController.php

示例6: run

 public function run()
 {
     $date = new \DateTime();
     $people = $users = $userGroups = $groupList = $teamMembers = $members = $userAccounts = $teams = $teamLanguages = $teamLanguageSupports = [];
     //Reading the CSV file to get a list of groups
     $groupCSV = \League\Csv\Reader::createFromPath($this->baseDir . 'users_groups_permissions.tsv', 'r');
     $groupCSV->setDelimiter(chr(9));
     $groupCSVData = $groupCSV->fetchAssoc();
     foreach ($groupCSVData as $data) {
         if ($data['group_name'] != 'users' && $data['group_name'] != 'administrators') {
             Models\Group::create(['group_name' => $data['group_name']]);
         }
     }
     //Getting the groups we just created from the db and an associative array
     $dbGroups = Models\Group::query()->pluck('group_id', 'group_name')->toArray();
     //Every user gets a password of test, for testing purposes
     $userPassword = bcrypt('test');
     $personDBColumns = $this->getFillableDBModelFields('\\App\\Models\\Person');
     //Reading the users CSV file
     $userCSV = \League\Csv\Reader::createFromPath($this->baseDir . 'users.tsv', 'r');
     $userCSV->setDelimiter(chr(9));
     $userCSVData = $userCSV->fetchAssoc();
     foreach ($userCSVData as $key => $data) {
         //We use every column in the CSV whose name matches with a field in the people table
         $people[$key] = $this->fillArrayFromModel($data, array_flip($personDBColumns));
         $people[$key]['person_birthdate'] = strtotime($people[$key]['person_birthdate']);
         $users[$key] = ['email' => $data['email'], 'name' => $data['name'], 'password' => $userPassword, 'activated' => true, 'last_login' => $date, 'created_at' => $date];
         $users[$key]['person_id'] = $key + 1;
         //Adding users to their groups
         if (!empty($data['groups'])) {
             $groups = explode(',', $data['groups']);
             if (!empty($groups)) {
                 foreach ($groups as $group) {
                     if (isset($dbGroups[$group]) && $group != 'users') {
                         $userGroups[] = ['user_id' => $key + 1, 'group_id' => $dbGroups[$group]];
                     }
                 }
             }
         }
         //Everyone gets to be a part of the users group, yay!
         $userGroups[] = ['user_id' => $key + 1, 'group_id' => Models\Group::users];
     }
     DB::table('people')->insert($people);
     DB::table('users')->insert($users);
     DB::table('user_groups')->insert($userGroups);
     $this->command->info('Users & Groups seeded');
 }
开发者ID:linguisticteam,项目名称:laravel-boilerplate,代码行数:47,代码来源:UserGroupSeeder.php

示例7: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     $Role1 = \App\Models\Role::create(['title' => 'Пользователь', 'default' => true]);
     $Role2 = \App\Models\Role::create(['title' => 'Администратор', 'admin' => true]);
     \App\Models\Group::create(['title' => 'КИТ-10']);
     $Group1 = \App\Models\Group::create(['title' => 'КИТ-10']);
     \App\Models\Group::create(['title' => 'КИТ-20']);
     $Group2 = \App\Models\Group::create(['title' => 'КИТ-30']);
     \App\Models\Group::create(['title' => 'КИТ-40']);
     \App\User::create(['first_name' => 'Admin', 'last_name' => 'Admin', 'second_name' => 'Admin', 'email' => 'admin@admin.com', 'password' => bcrypt('admin'), 'group_id' => $Group2->id, 'role_id' => $Role2->id]);
     \App\User::create(['first_name' => 'Test first name', 'last_name' => 'Test last name', 'second_name' => 'Test second name', 'email' => 'test@test.com', 'password' => bcrypt('123456'), 'group_id' => $Group1->id, 'role_id' => $Role1->id]);
     \Illuminate\Support\Facades\DB::table('type_question')->insert([['title' => 'radio'], ['title' => 'checkbox']]);
     $Prototype = \App\Models\Prototype::create(['title' => 'Тест по биологии', 'time' => 40, 'count_questions' => 5]);
     $Question = \App\Models\Question::create(['prototype_id' => $Prototype->id, 'text' => 'Сколько лап у ежа?', 'type' => 'radio']);
     $Answer = \App\Models\Answer::create(['text' => '4', 'right' => true, 'question_id' => $Question->id]);
     $Answer = \App\Models\Answer::create(['text' => '6', 'question_id' => $Question->id]);
     $Answer = \App\Models\Answer::create(['text' => 'Много', 'question_id' => $Question->id]);
     $Question = \App\Models\Question::create(['prototype_id' => $Prototype->id, 'text' => 'Какая длина хобота у слона?', 'type' => 'radio']);
     $Answer = \App\Models\Answer::create(['text' => 'У слона нет хобота', 'question_id' => $Question->id]);
     $Answer = \App\Models\Answer::create(['text' => '2 метра', 'question_id' => $Question->id]);
     $Answer = \App\Models\Answer::create(['text' => 'Зависит от возраста', 'right' => true, 'question_id' => $Question->id]);
     $Question = \App\Models\Question::create(['prototype_id' => $Prototype->id, 'text' => 'Сколько рёбер у человека?', 'type' => 'radio']);
     $Answer = \App\Models\Answer::create(['text' => '12 пар', 'question_id' => $Question->id]);
     $Answer = \App\Models\Answer::create(['text' => 'Кто такой человек?', 'right' => true, 'question_id' => $Question->id]);
     $Question = \App\Models\Question::create(['prototype_id' => $Prototype->id, 'text' => 'Какие типы данных из перечисленных есть в PHP?', 'type' => 'checkbox']);
     $Answer = \App\Models\Answer::create(['text' => 'Integer', 'right' => true, 'question_id' => $Question->id]);
     $Answer = \App\Models\Answer::create(['text' => 'Float', 'right' => true, 'question_id' => $Question->id]);
     $Answer = \App\Models\Answer::create(['text' => 'String', 'right' => true, 'question_id' => $Question->id]);
     $Answer = \App\Models\Answer::create(['text' => 'Char', 'question_id' => $Question->id]);
     $Answer = \App\Models\Answer::create(['text' => 'Array', 'right' => true, 'question_id' => $Question->id]);
     $Answer = \App\Models\Answer::create(['text' => 'Callbacks / Callables', 'right' => true, 'question_id' => $Question->id]);
     $Question = \App\Models\Question::create(['prototype_id' => $Prototype->id, 'text' => 'Какой оператор выполняет строгое сравнение?', 'type' => 'radio']);
     $Answer = \App\Models\Answer::create(['text' => '==', 'question_id' => $Question->id]);
     $Answer = \App\Models\Answer::create(['text' => '===', 'right' => true, 'question_id' => $Question->id]);
     $Answer = \App\Models\Answer::create(['text' => '&', 'question_id' => $Question->id]);
     $Question = \App\Models\Question::create(['prototype_id' => $Prototype->id, 'text' => 'Какой оператор не правильный?', 'type' => 'radio']);
     $Answer = \App\Models\Answer::create(['text' => '$a and $b', 'question_id' => $Question->id]);
     $Answer = \App\Models\Answer::create(['text' => '$a or $b', 'right' => true, 'question_id' => $Question->id]);
     $Answer = \App\Models\Answer::create(['text' => '! $a', 'right' => true, 'question_id' => $Question->id]);
     $Answer = \App\Models\Answer::create(['text' => '$a => $b', 'right' => true, 'question_id' => $Question->id]);
     $Answer = \App\Models\Answer::create(['text' => '$a <= $b', 'right' => true, 'question_id' => $Question->id]);
     // $this->call('UserTableSeeder');
 }
开发者ID:DJZT,项目名称:tezter,代码行数:49,代码来源:DatabaseSeeder.php

示例8: index

 public function index()
 {
     $fh = fopen("../resources/primary.csv", "r");
     $posts = $groups = 0;
     $connection = Connections::get('default')->connection;
     foreach (array('posts', 'groups', 'grants', 'grant_groups') as $collection) {
         $connection->{$collection}->remove(array());
     }
     while ($data = fgetcsv($fh)) {
         list($tmp, $postId, $desc, $y2011, $y2010, $y2009) = $data;
         if (!empty($tmp)) {
             /**
              * Keep track of group name
              */
             if (strpos($tmp, "Totalt") === false) {
                 $group = Group::create();
                 list($number, $name) = explode(" - ", $tmp);
                 $name = str_replace('"', "", trim($name));
                 $number = trim($number);
                 $group->save(array('name' => $name, 'number' => $number));
                 $groupId = $group->_id;
                 $groups++;
             } elseif ($group) {
                 $group->y2011 = (int) ($y2011 / 1000);
                 $group->y2010 = (int) ($y2010 / 1000);
                 $group->y2009 = (int) ($y2009 / 1000);
                 $group->save();
                 continue;
             }
         }
         /**
          * Place in previously mentioned group
          */
         if (isset($groupId)) {
             $post = Post::create();
             $post->save(array('post' => (double) $postId, 'desc' => trim($desc), 'y2011' => (int) ($y2011 / 1000), 'y2010' => (int) ($y2010 / 1000), 'y2009' => (int) ($y2009 / 1000), 'groupId' => $groupId));
             $posts++;
         }
     }
     // Grants
     return compact('groups', 'posts') + $this->grants();
 }
开发者ID:nervetattoo,项目名称:Bergenbudsjett,代码行数:42,代码来源:ImportController.php

示例9: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Requests\Admin\Groups\Create $request)
 {
     $Group = Group::create($request->all());
     return redirect(route('admin.groups.list'))->with('success', "Группа {$Group->title} создана!");
 }
开发者ID:DJZT,项目名称:tezter,代码行数:10,代码来源:GroupsController.php

示例10: store

 public function store(CreateGroupRequest $request)
 {
     $groupType = Group::create($request->all());
     return redirect()->route('groups.index')->with('successes', ['Group created successfully']);
 }
开发者ID:pinkynrg,项目名称:convergence2.0,代码行数:5,代码来源:GroupsController.php


注:本文中的app\models\Group::create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。