Exemplo n.º 1
0
    public function detail($id)
    {
        $title = 'group';
        $users = Induser::leftjoin('groups_users', 'indusers.id', '=', 'groups_users.user_id')->leftjoin('groups', 'groups.admin_id', '=', 'indusers.id')->join('groups as g', 'g.id', '=', 'groups_users.group_id')->where('groups_users.group_id', '=', $id)->where('g.id', '=', $id)->whereNotNull('groups_users.group_id')->orderBy('groups.admin_id', 'desc')->groupBy('indusers.id')->get(['indusers.id', 'indusers.fname', 'indusers.lname', 'indusers.role', 'indusers.city', 'indusers.state', 'indusers.profile_pic', 'groups_users.id as groups_users_id', 'groups_users.group_id', 'g.admin_id']);
        // $connectionsList = Auth::user()->induser->friends->lists('fname','id');
        $connections = DB::select('select id,fname,lname,working_at,city,state,profile_pic from indusers
									where indusers.id in (

									select connections.user_id as id from connections
									where connections.connection_user_id=?
									 and connections.status=1 
									 and connections.user_id not in (
										select groups_users.user_id from groups_users
										where groups_users.group_id=?)
									union 
									select connections.connection_user_id as id from connections
									where connections.user_id=?
									 and connections.status=1
									 and connections.connection_user_id not in (
										select groups_users.user_id from groups_users
										where groups_users.group_id=?)
								)', [Auth::user()->induser_id, $id, Auth::user()->induser_id, $id]);
        $group = Group::where('id', '=', $id)->with('admin')->first();
        return view('pages.groupDetail', compact('users', 'title', 'connections', 'group'));
        // return $group;
    }
Exemplo n.º 2
0
    public function search()
    {
        $title = 'Search';
        if (Session::has('search_query')) {
            $searchQuery = Session::get('search_query');
        }
        if (Input::get('query') != null) {
            $searchQuery = Input::get('query');
        }
        Session::flash('search_query', $searchQuery);
        $links = DB::select('select id from indusers
										where indusers.id in (
												select connections.user_id as id from connections
												where connections.connection_user_id=?
												 and connections.status=1
												union 
												select connections.connection_user_id as id from connections
												where connections.user_id=?
												 and connections.status=1
									)', [Auth::user()->induser_id, Auth::user()->induser_id]);
        $links = collect($links);
        $linksApproval = DB::select('select id from indusers
									where indusers.id in (
											select connections.user_id as id from connections
											where connections.connection_user_id=?
											 and connections.status=0
									)', [Auth::user()->induser_id]);
        $linksApproval = collect($linksApproval);
        $linksPending = DB::select('select id from indusers
									where indusers.id in (
											select connections.connection_user_id as id from connections
											where connections.user_id=?
											 and connections.status=0
									)', [Auth::user()->induser_id]);
        $linksPending = collect($linksPending);
        $following = DB::select('select id from corpusers 
								 where corpusers.id in (
									select follows.corporate_id as id from follows
									where follows.individual_id=?
							)', [Auth::user()->induser_id]);
        $following = collect($following);
        if ($searchQuery != null) {
            $searchResultForInd = Induser::leftjoin('users', 'users.induser_id', '=', 'indusers.id')->where('users.inactive', '=', 0)->where('users.email_verify', '=', 1)->where('users.mobile_verify', '=', 1)->whereRaw("(indusers.fname like '%" . $searchQuery . "%' or indusers.lname like '%" . $searchQuery . "%' or indusers.email like '%" . $searchQuery . "%' or indusers.mobile like '%" . $searchQuery . "%')")->paginate(10);
            $searchResultForCorp = Corpuser::leftjoin('users', 'users.corpuser_id', '=', 'corpusers.id')->where('users.inactive', '=', 0)->where('users.email_verify', '=', 1)->where('users.mobile_verify', '=', 1)->whereRaw("(corpusers.firm_name like '%" . $searchQuery . "%' or corpusers.firm_email_id like '%" . $searchQuery . "%' or corpusers.firm_phone like '%" . $searchQuery . "%')")->paginate(10);
            $searchResultForJob = Postjob::orderBy('id', 'desc')->with('indUser', 'corpUser', 'postActivity', 'taggedUser', 'taggedGroup', 'preferLocations')->where('post_type', '=', 'job')->where('inactive', '=', 0)->where('individual_id', '!=', Auth::user()->induser_id)->whereRaw("(post_title like '%" . $searchQuery . "%' or linked_skill like '%" . $searchQuery . "%' or post_compname like '%" . $searchQuery . "%')")->paginate(10);
            $searchResultForSkill = Postjob::orderBy('id', 'desc')->where('post_type', '=', 'skill')->where('inactive', '=', 0)->where('individual_id', '!=', Auth::user()->induser_id)->whereRaw("(post_title like '%" . $searchQuery . "%' or linked_skill like '%" . $searchQuery . "%')")->paginate(10);
            return view('pages.search', compact('title', 'searchQuery', 'searchResultForInd', 'searchResultForCorp', 'searchResultForJob', 'searchResultForSkill', 'linksPending', 'linksApproval', 'links', 'following'));
        }
    }