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


PHP Group::save方法代码示例

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


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

示例1: updateGroups

 public static function updateGroups(Request $request)
 {
     $titles = $request::get('title');
     $ids = $request::get('id');
     $deleteId = $request::get('delete');
     $newtitle = $request::get('newtitle');
     $i = 0;
     if ($ids) {
         foreach ($ids as $id) {
             $group = Group::find($id);
             $group->title = $titles[$i];
             if (isset($deleteId[$i]) && $deleteId[$i] == $id) {
                 $group->delete();
             } else {
                 $group->save();
             }
             $i++;
         }
     }
     if ($newtitle) {
         $group = new Group();
         $group->title = $newtitle;
         $group->save();
     }
     return true;
 }
开发者ID:jtoshmat,项目名称:laravel,代码行数:26,代码来源:Group.php

示例2: axsave

 public function axsave(Request $request)
 {
     //
     $response = array('status' => 'success', 'msg' => 'OK!');
     $rules = array('fname' => 'required', 'fremark' => 'required', 'femail' => 'required');
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         $response['status'] = "warning";
         $response['msg'] = $validator->messages()->toJson();
         return response()->json($response);
     } else {
         try {
             $gid = Input::get('fid');
             if ($gid != 'Neu') {
                 $group = Group::find($gid);
             } else {
                 $group = new Group();
             }
             $group->name = Input::get('fname');
             $group->remark = Input::get('fremark');
             $group->email = Input::get('femail');
             //$user = \App\User::find(1) ;
             $group->manager()->associate(Input::get('fmanager'));
             $group->save();
         } catch (\Illuminate\Database\QueryException $e) {
             $response['status'] = "danger";
             $response['msg'] = "Database error: " . $e->getMessage();
             return response()->json($response);
         }
         //return Response::json( $response );
         return response()->json($response);
     }
     //validatorf
 }
开发者ID:machiidev,项目名称:lapp1,代码行数:34,代码来源:GroupController.php

示例3: addGp

 public function addGp($name, $courseId)
 {
     $gp = new Group();
     $gp->name = $name;
     $gp->course_id = $courseId;
     $gp->save();
 }
开发者ID:joseph1125,项目名称:cis,代码行数:7,代码来源:GroupsController.php

示例4: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $group = new Group();
     $group->name = 'Projects';
     $group->officer_id = 1;
     $group->save();
     $group->members()->attach(1);
 }
开发者ID:kocsenc,项目名称:api,代码行数:13,代码来源:GroupTableSeeder.php

示例5: createTestGroup

 private static function createTestGroup()
 {
     $group = new Group();
     $group->name = 'Test123';
     $group->scout_group = 'Test_group123';
     $group->age_group = 'sudenpennut';
     $group_id = $group->save();
     return $group_id;
 }
开发者ID:partio-scout,项目名称:kokous_backend,代码行数:9,代码来源:ActivityViewTest.php

示例6: store

 /**
  * Store a newly created group in storage.
  *
  * @Post("/")
  * @Transaction(
  *     @Request({"name": "Heist Organizers", "officer_id": 1}),
  *     @Response(201, body={{"id": 2, "name": "Heist Organizers",
  *                           "officer_id": 1, "officer_url": "/officers/1",
  *                           "url": "/groups/2"}}),
  *     @Response(422, body={"name": {"The name is already taken."},
  *                          "officer_id": {"The officer id does not exist."}})
  * )
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     $this->validate($request, ['name' => 'required|unique:groups,name', 'officer_id' => 'required|exists:officers,id']);
     $group = new Group();
     $group->name = $request->input('name');
     $group->officer_id = $request->input('officer_id');
     $group->save();
     return new JsonResponse($group, Response::HTTP_CREATED);
 }
开发者ID:rit-sse,项目名称:api,代码行数:24,代码来源:GroupController.php

示例7: createGroup

 public function createGroup(CreateGroupRequest $requests)
 {
     $group = new Group();
     $group->user_id = Auth::id();
     $group->name = $requests->name;
     $group->status = 1;
     $group->save();
     return '<div class="alert alert-success" role="alert">List Created</div>';
 }
开发者ID:reuf,项目名称:mistral,代码行数:9,代码来源:MainController.php

示例8: store

 /**
  * Store a newly created resource in storage.
  *
  * @param Request $request
  * @return Response
  */
 public function store(Request $request)
 {
     $this->validate($request, ['name' => 'regex:/[A-Za-z0-9\\ \\_\\,\\-\\.]+/|max:255']);
     $newGroup = new Group();
     $newGroup->name = $request->input('name');
     $newGroup->save();
     $msg = "Added new group!";
     return redirect('group')->with('message', $msg);
 }
开发者ID:rayGobel,项目名称:sircular-dev,代码行数:15,代码来源:GroupController.php

示例9: update

 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update(Group $group, Request $request)
 {
     $validator = Validator::make($request->all(), ['name' => 'sometimes|required', 'open' => 'sometimes|required|boolean', 'service_provider' => 'sometimes|required|boolean']);
     $group->name = $request->name ? $request->name : $group->name;
     $group->open = $request->open ? (bool) $request->open : $group->open;
     $group->service_provider = $request->service_provider ? (bool) $request->service_provider : $group->service_provider;
     if ($group->save()) {
         return $this->respondWithItem($group, new GroupTransformer());
     }
 }
开发者ID:jasonb8293,项目名称:fox-api,代码行数:16,代码来源:GroupController.php

示例10: createGroup

 public function createGroup(Request $request)
 {
     $user = Auth::user();
     $group = new Group();
     $group->gname = $request->input('gname');
     $group->user_id = $user->id;
     $group->save();
     $group->members()->attach(array($user->id));
     //Adds user as member of group
     return Redirect::action('PagesController@dashboard');
 }
开发者ID:Jessehuze,项目名称:se-group8,代码行数:11,代码来源:PagesController.php

示例11: testGroupCanBeDeleted

 public function testGroupCanBeDeleted()
 {
     $this->logIn();
     session()->set('admin', 1);
     $group = new Group();
     $group->name = 'RyhmäA';
     $group->scout_group = 'Lippulaiset';
     $group->age_group = 'Vuotiaat';
     $group->save();
     $this->visit('/groups/1')->press('Poista')->seePageIs('/groups')->dontSee('RyhmäA');
 }
开发者ID:partio-scout,项目名称:kokous_backend,代码行数:11,代码来源:GroupViewTest.php

示例12: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     $group = new Group();
     $group->group_name = $request['group_name'];
     $group->admin_id = Auth::user()->induser_id;
     $group->save();
     $groupuser = new Groups_users();
     $groupuser->group_id = $group->id;
     $groupuser->user_id = Auth::user()->induser_id;
     $group->adminUser()->save($groupuser);
     return redirect('/group/' . $group->id);
     // return $group;
 }
开发者ID:devvicky,项目名称:Jobb-new,代码行数:18,代码来源:GroupController.php

示例13: store

 public function store()
 {
     $input = Input::all();
     $input = $input['group'];
     $validator = Validator::make($input, ['name' => 'required', 'description' => 'required', 'sport_id' => 'required']);
     if ($validator->fails()) {
         return $this->respondNotFound($validator->errors());
     }
     $group = new Group();
     $group->name = $input['name'];
     $group->description = $input['description'];
     $group->sport_id = $input['sport_id'];
     $group->save();
     return $this->setStatusCode(200)->respond(["group" => $this->groupTransformer->transform($group), "message" => "succesfully created the group"]);
 }
开发者ID:mathijsjansen1987,项目名称:mytrainr_backend,代码行数:15,代码来源:GroupController.php

示例14: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(AddGroupRequest $request)
 {
     $group = new Group();
     /*$v = Validator::make($request->all(), [
     			"groupname" => "required|min:3|max:255|unique:groups",
     	    ]);
     
     	    if ($v->fails()){
     		    return $v->messages()->toJson();
     		}*/
     $group->groupname = $request->get('groupname');
     $group->description = $request->get('description');
     $group->save();
     return redirect()->route('groups.index')->with('messageOk', 'Add group successfully!');
 }
开发者ID:phanngoc,项目名称:internal-tool,代码行数:20,代码来源:GroupController.php

示例15: testUserCanBeRemovedFromTheGroup

 public function testUserCanBeRemovedFromTheGroup()
 {
     $this->logIn();
     $group = new Group();
     $group->name = 'TestiRyhmä';
     $group->scout_group = 'Lippukunta';
     $group->age_group = 'Ikäryhmä';
     $group->save();
     $user = new User();
     $user->id = '23';
     $user->membernumber = '2312334212';
     $user->firstname = 'Liisa';
     $user->lastname = 'Saarenmaa';
     $user->save();
     $this->visit('/groups/1/users')->press('Lisää ryhmän jäsen')->see('Liisa')->press('Poista')->dontSee('Poista');
 }
开发者ID:partio-scout,项目名称:kokous_backend,代码行数:16,代码来源:GroupUserViewTest.php


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