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


PHP Group::with方法代码示例

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


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

示例1: index

 public function index()
 {
     $groups = Group::with(['users' => function ($query) {
         $query->where('active', 1);
     }])->orderBy('name', 'ASC')->get();
     return view('index', compact('groups'));
 }
开发者ID:mauri870,项目名称:groups-and-users,代码行数:7,代码来源:HomeController.php

示例2: index

 public function index()
 {
     $all_groups = \App\Group::with('users')->get();
     $title = 'Groups';
     $html = view('admin.groups.table', compact('title', 'all_groups'))->render();
     return Admin::view($html);
 }
开发者ID:strikles,项目名称:php,代码行数:7,代码来源:AdminGroupsController.php

示例3: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $title = 'group';
     $groups = Group::with('postsCount')->leftjoin('groups_users', 'groups_users.group_id', '=', 'groups.id')->where('groups.rowStatus', '=', 0)->where('groups.admin_id', '=', Auth::user()->induser_id)->orWhere('groups_users.user_id', '=', Auth::user()->induser_id)->where('groups.rowStatus', '=', 0)->groupBy('groups.id')->get(['groups.id', 'groups.group_name', 'groups.admin_id', 'groups.created_at']);
     // $connections = Auth::user()->induser->friends->lists('fname', 'id');
     return view('pages.group', compact('groups', 'title'));
 }
开发者ID:devvicky,项目名称:Jobb-new,代码行数:12,代码来源:GroupController.php

示例4: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $group = Group::with('events')->findOrFail($id);
     $users = $group->users;
     return view('group', compact('group'), compact('users'));
     //
 }
开发者ID:partio-scout,项目名称:kokous_backend,代码行数:13,代码来源:GroupController.php

示例5: show

 /**
  * Display the specified group.
  *
  * @Get("/{id}")
  * @Transaction(
  *     @Response(200, body={{"id": 1, "name": "Website Committee",
  *                           "officer_id": 1, "officer_url": "/officers/1",
  *                           "url": "/groups/1"}}),
  *     @Response(404, body={"error": "not found"})
  * )
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     try {
         $group = Group::with('officer')->findOrFail($id);
         return response()->json($group);
     } catch (ModelNotFoundException $e) {
         return new JsonResponse(['error' => 'not found'], Response::HTTP_NOT_FOUND);
     }
 }
开发者ID:rit-sse,项目名称:api,代码行数:22,代码来源:GroupController.php

示例6: getAll

 public function getAll()
 {
     $groups = Group::with('posts')->orderBy('updated_at', 'desc')->paginate(10);
     foreach ($groups as $key => $group) {
         if (empty($group->pic)) {
             $groups[$key]->pic = asset(env('LOGO'));
         }
     }
     return $groups;
 }
开发者ID:rhofma,项目名称:rhofma.de,代码行数:10,代码来源:SeriesService.php

示例7: create

 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create()
 {
     $title = 'links';
     $user = Induser::with('user')->where('id', '=', Auth::user()->induser_id)->first();
     $linksCount = Connections::where('user_id', '=', Auth::user()->induser_id)->where('status', '=', 1)->orWhere('connection_user_id', '=', Auth::user()->induser_id)->where('status', '=', 1)->count('id');
     $linkrequestCount = Connections::where('connection_user_id', '=', Auth::user()->induser_id)->where('status', '=', 0)->count('id');
     $followCount = Follow::Where('individual_id', '=', Auth::user()->induser_id)->count('id');
     $linkFollow = Corpuser::with('posts')->leftjoin('follows', 'corpusers.id', '=', 'follows.corporate_id')->where('follows.individual_id', '=', Auth::user()->induser_id)->get(['corpusers.id', 'corpusers.firm_name', 'corpusers.firm_type', 'corpusers.emp_count', 'corpusers.logo_status', 'corpusers.operating_since', 'corpusers.city', 'follows.corporate_id', 'follows.individual_id']);
     $groups = Group::with('postsCount')->leftjoin('groups_users', 'groups_users.group_id', '=', 'groups.id')->where('groups.rowStatus', '=', 0)->where('groups.admin_id', '=', Auth::user()->induser_id)->orWhere('groups_users.user_id', '=', Auth::user()->induser_id)->where('groups.rowStatus', '=', 0)->groupBy('groups.id')->get(['groups.id', 'groups.group_name', 'groups.admin_id', 'groups.created_at']);
     return view('pages.connections', compact('title', 'user', 'linkFollow', 'linksCount', 'linkrequestCount', 'followCount', 'groups'));
 }
开发者ID:devvicky,项目名称:Jobb-new,代码行数:16,代码来源:ConnectionsController.php

示例8: teamsCsv

 public function teamsCsv()
 {
     if (Gate::denies('admin')) {
         Auth::logout();
         return redirect('/admin/login');
     }
     $teams = Group::with('idea')->get();
     $columns = ['id', 'name', 'created_at', 'idea.name', 'idea.repository', 'idea.description', 'idea.created_at'];
     $headers = ['ID', 'Name', 'Registered At', 'Idea Name', 'Idea Repository', 'Idea Description', 'Idea Registered At'];
     $csv = $this->exportCsv($teams, $columns, $headers);
     $csvName = 'eca-teams-' . date('Y-m-d-His') . '.csv';
     return response($csv, 200, ['Content-type' => 'text/csv', 'Content-Disposition' => sprintf('attachment; filename="%s"', $csvName), 'Content-Length' => strlen($csv)]);
 }
开发者ID:jirojo2,项目名称:pleem,代码行数:13,代码来源:AdminController.php

示例9: my

 public function my()
 {
     $groups = \App\Group::with('membership')->orderBy('name')->paginate(50);
     $my_groups = Auth::user()->groups()->orderBy('name')->get();
     $my_groups_id = false;
     // using this array we can adjust the queries after to only include stuff the user has
     // might be a good idea to find a clever way to build this array of groups id :
     foreach ($my_groups as $the_group) {
         $my_groups_id[] = $the_group->id;
     }
     $my_discussions = \App\Discussion::with('userReadDiscussion', 'user', 'group')->whereIn('group_id', $my_groups_id)->orderBy('updated_at', 'desc')->paginate(10);
     $my_actions = \App\Action::with('user', 'group')->whereIn('group_id', $my_groups_id)->where('start', '>=', Carbon::now())->orderBy('start', 'asc')->paginate(10);
     $other_discussions = \App\Discussion::with('userReadDiscussion', 'user', 'group')->whereNotIn('group_id', $my_groups_id)->orderBy('updated_at', 'desc')->paginate(10);
     $other_actions = \App\Action::with('user', 'group')->whereNotIn('group_id', $my_groups_id)->where('start', '>=', Carbon::now())->orderBy('start', 'asc')->paginate(10);
     return view('dashboard.my')->with('groups', $groups)->with('my_groups', $my_groups)->with('my_discussions', $my_discussions)->with('my_actions', $my_actions)->with('other_actions', $other_actions)->with('other_discussions', $other_discussions);
 }
开发者ID:philippejadin,项目名称:Mobilizator,代码行数:16,代码来源:DashboardController.php

示例10: update

 public function update($groupId)
 {
     $rules = ['name' => 'required'];
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $group = Group::with(['owners', 'members'])->findOrFail($groupId);
     $this->authorize('update', $group);
     $group->name = Input::get('name');
     $group->description = Input::get('description');
     $memberDatas = [];
     $members = Input::has('members') ? Input::get('members') : [];
     foreach ($members as $member) {
         $memberDatas[$member] = ['is_owner' => 0];
     }
     $owners = Input::has('owners') ? Input::get('owners') : [];
     foreach ($owners as $owner) {
         $memberDatas[$owner] = ['is_owner' => 1];
     }
     $group->members()->sync($memberDatas);
     $group->save();
     return Redirect::back()->with(['success_message' => 'Updated!']);
 }
开发者ID:nguyenvanduocit,项目名称:Password-Manager,代码行数:24,代码来源:GroupController.php

示例11: findByName

 /**
  * find group with users by group name
  * 
  * @param  [type] $name [description]
  * @return [type]       [description]
  */
 public function findByName($name)
 {
     return Group::with('users')->where('name', $name)->first();
 }
开发者ID:agoiabel,项目名称:church-worker-management-app,代码行数:10,代码来源:GroupRepository.php

示例12: show

 public function show($id)
 {
     $group = Group::with('users', 'indicators')->find($id);
     $this->authorize($group);
     return $group;
 }
开发者ID:ppawlas,项目名称:swop,代码行数:6,代码来源:GroupController.php

示例13: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index($groupId)
 {
     $group = Group::with('members')->findOrFail($groupId);
     return response()->json($group->members);
 }
开发者ID:rit-sse,项目名称:api,代码行数:10,代码来源:GroupMemberController.php

示例14: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $group = Group::with('members')->with('scores')->with('idea')->findOrFail($id);
     return response()->json($group);
 }
开发者ID:abada,项目名称:pleem,代码行数:11,代码来源:GroupController.php

示例15: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $profiles = Group::with('user')->find(1)->toJson();
     var_dump($profiles);
 }
开发者ID:rereyossi,项目名称:hairstuation,代码行数:10,代码来源:GroupController.php


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