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


PHP Group::users方法代码示例

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


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

示例1: listUsers

 public function listUsers($description)
 {
     if (!isset($description)) {
         return "bad";
     }
     $group = new Group();
     return $group->users($description);
 }
开发者ID:marcocastignoli,项目名称:lumen_auth,代码行数:8,代码来源:GroupController.php

示例2: embed

 /**
  * Renders a embedable map
  */
 public function embed(Group $group)
 {
     $users = $group->users()->where('latitude', '<>', 0)->get();
     $actions = $group->actions()->where('start', '>=', Carbon::now())->where('latitude', '<>', 0)->get();
     // randomize users geolocation by a few meters
     foreach ($users as $user) {
         $user->latitude = $user->latitude + mt_rand(0, 10) / 10000;
         $user->longitude = $user->longitude + mt_rand(0, 10) / 10000;
     }
     return view('groups.map_embed')->with('tab', 'map')->with('group', $group)->with('users', $users)->with('actions', $actions)->with('latitude', 50.8503396)->with('longitude', 4.3517103);
 }
开发者ID:philippejadin,项目名称:Mobilizator,代码行数:14,代码来源:MapController.php

示例3: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     $validator = Validator::make($request->all(), ['name' => 'required', 'open' => 'required|boolean', 'service_provider' => 'required|boolean', 'sites' => 'required']);
     $sites = explode(',', $request->sites);
     $group = new Group();
     $group->name = $request->name;
     $group->open = (bool) $request->open;
     $group->service_provider = (bool) $request->service_provider;
     if ($group->save()) {
         $group->sites()->sync($sites);
         $group->users()->attach(Auth::user()->id, ['permission_id' => 1]);
         return $this->respondWithItem($group, new GroupTransformer());
     }
 }
开发者ID:jasonb8293,项目名称:fox-api,代码行数:19,代码来源:GroupController.php

示例4: store

 /**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $this->validate($request, ['name' => 'required|max:64', 'scout_group' => 'required|max:64', 'age_group' => 'required|max:64']);
     $group = new Group();
     $group->name = $request->input('name');
     $group->scout_group = $request->input('scout_group');
     $group->age_group = $request->input('age_group');
     $group->save();
     // Jäsenet
     $participants = $request->input('participants');
     if (isset($participants)) {
         foreach ($participants as $participant) {
             $group->users()->attach($participant, ['role' => 'member']);
         }
     }
     //Ryhmänjohtajat
     $leaders = $request->input('leaders');
     if (isset($leaders)) {
         foreach ($leaders as $leader) {
             $group->users()->attach($leader, ['role' => 'leader']);
         }
     }
     return redirect('groups');
 }
开发者ID:partio-scout,项目名称:kokous_backend,代码行数:29,代码来源:GroupController.php

示例5: store

 public function store(CreateGroupRequest $request)
 {
     if (Gate::denies('managerOnly')) {
         abort(403);
     }
     $input = $request->all();
     $result = DB::transaction(function ($input) use($input) {
         $group = new Group();
         $group->name = $input['name'];
         $group->organization()->associate(Auth::user()->organization);
         $group->save();
         foreach ($input['users'] as $user) {
             $group->users()->attach($user['id']);
         }
         foreach ($input['indicators'] as $indicator) {
             $group->indicators()->attach($indicator['id']);
         }
         return $group;
     });
     return $result;
 }
开发者ID:ppawlas,项目名称:swop,代码行数:21,代码来源:GroupController.php

示例6: getLatestMembers

 /**
  * Created By Dara on 31/10/2015
  * get the last 5 members
  */
 public function getLatestMembers(Group $group)
 {
     $users = $group->users()->latest()->take(5)->get();
     return $users;
 }
开发者ID:emadmrz,项目名称:Hawk,代码行数:9,代码来源:GroupRepository.php

示例7: function

 /**
  * POST /groups
  * Create a new group and add authenticated user to it
  */
 Route::post('/groups', function (Request $request) {
     if (Auth::check()) {
         $v = Validator::make($request->all(), ['name' => 'required|max:255']);
         if ($v->fails()) {
             return redirect()->back()->withInput()->withErrors($v);
         }
         // Create New Group
         $group = new Group();
         $group->name = $request->name;
         $group->description = trim($request->description);
         $group->save();
         $group->users()->save(Auth::user());
         return redirect()->back();
     } else {
         return redirect('/');
     }
 });
 /**
  * DELETE /group/{id}
  * Delete the group corresponding to {id}
  */
 Route::delete('/group/{id}', function ($id) {
     if (Auth::check()) {
         $group = Group::findOrFail($id);
         $group->users()->where('id', '=', Auth::id())->detach();
         return redirect('/groups');
     } else {
开发者ID:TwoBitAlchemist,项目名称:kbay-bsm-laravel-hw,代码行数:31,代码来源:routes.php

示例8: leave

 public function leave(Group $group, Request $request)
 {
     $user = Auth::user();
     if ($request->user()->cannot('join-group', [$group])) {
         //the user is not a member so we add him/her to the group
         $group->users()->detach([$user->id]);
     }
     return redirect()->back();
     //        return[
     //            'hasCallback'=>1,
     //            'callback'=>'group_join',
     //            'hasMsg'=>0,
     //            'msg'=>'',
     //            'msgType'=>'',
     //            'returns'=> [
     //                'status'=>'undo'
     //            ]
     //
     //        ];
 }
开发者ID:emadmrz,项目名称:Hawk,代码行数:20,代码来源:GroupController.php


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