public function index() { $groups = Group::with(['users' => function ($query) { $query->where('active', 1); }])->orderBy('name', 'ASC')->get(); return view('index', compact('groups')); }
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); }
/** * 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')); }
/** * 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')); // }
/** * 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); } }
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; }
/** * 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')); }
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)]); }
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); }
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!']); }
/** * 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(); }
public function show($id) { $group = Group::with('users', 'indicators')->find($id); $this->authorize($group); return $group; }
/** * Display a listing of the resource. * * @return Response */ public function index($groupId) { $group = Group::with('members')->findOrFail($groupId); return response()->json($group->members); }
/** * 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); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $profiles = Group::with('user')->find(1)->toJson(); var_dump($profiles); }
public function getTasksAjax($gid) { $group = Group::with('tasks')->where('id', '=', $gid)->first(); return view('tasks_partial')->with('group', $group); }
/** * Display a listing of the resource. * * @return Response */ public function index() { return Group::with(['users'])->get(); }
/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { return Group::with('users')->findOrFail($id); }
/** * Display a listing of the resource. * * @return Response */ public function index($group_id) { $group = \App\Group::with('users')->findOrFail($group_id); $users = $group->users()->orderBy('name', 'asc')->paginate(25); return view('users.index')->with('users', $users)->with('group', $group)->with('tab', 'users'); }