Ejemplo n.º 1
0
    public function friendLink($utype, $id)
    {
        $title = 'friendLink';
        if ($utype == 'ind') {
            $linkName = Induser::findOrFail($id);
            $linkFollow = Corpuser::leftjoin('follows', 'corpusers.id', '=', 'follows.corporate_id')->where('follows.individual_id', '=', $id)->get(['corpusers.id', 'corpusers.firm_name', 'corpusers.logo_status', 'corpusers.operating_since', 'corpusers.city', 'follows.corporate_id', 'follows.individual_id']);
            $followCount = Follow::Where('individual_id', '=', $id)->count('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 
										union 
										select connections.connection_user_id as id from connections
										where connections.user_id=?
										 and connections.status=1
									)', [$id, $id]);
            $linksCount = Connections::where('user_id', '=', $id)->where('status', '=', 1)->orWhere('connection_user_id', '=', $id)->where('status', '=', 1)->count('id');
            return view('pages.friendlink', compact('linkName', 'title', 'linkFollow', 'connections', 'linksCount', 'followCount', 'utype'));
        } elseif ($utype == 'corp') {
            $followers = Corpuser::find($id)->followers;
            return view('pages.friendlink', compact('title', 'followers', 'utype'));
        }
    }
Ejemplo 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'));
        }
    }