Пример #1
0
 public function adminControlUpdate()
 {
     $controlCorp = Corpuser::with('user')->get(['id', 'firm_name', 'firm_type', 'firm_email_id']);
     $controlInd = Induser::with('user')->get(['id', 'fname', 'lname', 'email']);
     $controlUpdate = Admin_control::where('user_id', '=', Auth::user()->id)->first();
     if ($controlUpdate != null) {
         $controlUpdate->profile_id = Input::get('profile_id');
         $controlUpdate->subscribe = Input::get('subscribe');
         $controlUpdate->contact_view = Input::get('contact_view');
         $controlUpdate->resume_view = Input::get('view_resume');
         $controlUpdate->post_job = Input::get('post_job');
         $controlUpdate->save();
     } elseif ($controlUpdate == null) {
         $controlUpdate = new Admin_control();
         $controlUpdate->profile_id = Input::get('profile_id');
         $controlUpdate->subscribe = Input::get('subscribe');
         $controlUpdate->contact_view = Input::get('contact_view');
         $controlUpdate->resume_view = Input::get('view_resume');
         $controlUpdate->post_job = Input::get('post_job');
         $controlUpdate->save();
     }
     return view('pages.control_users', compact('controlUpdate', 'controlCorp', 'controlInd'));
 }
Пример #2
0
    public function searchConnections()
    {
        $keywords = Input::get('keywords');
        $users = Induser::with('user')->where('email', '=', $keywords)->where('id', '<>', Auth::user()->induser_id)->orWhere('fname', 'like', '%' . $keywords . '%')->where('id', '<>', Auth::user()->induser_id)->orWhere('lname', 'like', '%' . $keywords . '%')->where('id', '<>', Auth::user()->induser_id)->orWhere('working_at', 'like', '%' . $keywords . '%')->where('id', '<>', Auth::user()->induser_id)->get();
        $corps = DB::select('select cu.*,(select count(id) 
										from follows 
										where follows.corporate_id=cu.id) as followers from corpusers cu 
									where cu.firm_email_id = ? or 
										  cu.firm_name like ? or 
										  cu.firm_type like ? or 
										  cu.city like ?
										  ', [$keywords, '%' . $keywords . '%', '%' . $keywords . '%', '%' . $keywords . '%']);
        $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);
        $follows = DB::select('select follows.corporate_id as id 
								from follows 
								where follows.individual_id=?', [Auth::user()->induser_id]);
        $follows = collect($follows);
        return view('pages.searchUsers', compact('users', 'links', 'corps', 'follows', 'linksApproval', 'linksPending'));
    }
Пример #3
0
    public function searchProfile()
    {
        if (Auth::check()) {
            $title = 'Profile search';
            $city = Input::get('city');
            $name = Input::get('name');
            $role = Input::get('role');
            $working_at = Input::get('working_at');
            $mobile = Input::get('mobile');
            $type = Input::get('type');
            $firm_type = Input::get('firm_type');
            // return $firm_type;
            if ($type == 'people') {
                $users = Induser::with('user')->orderBy('id', 'desc')->where('id', '!=', Auth::user()->induser_id);
                if ($name != null) {
                    $users->whereRaw("(fname like '%" . $name . "%' or lname like '%" . $name . "%' or email = '" . $name . "')");
                }
                if ($city != null) {
                    $pattern = '/\\s*,\\s*/';
                    $replace = ',';
                    $city = preg_replace($pattern, $replace, $city);
                    $cityArray = explode(',', $city);
                    $users->whereIn('city', $cityArray);
                }
                if ($role != null) {
                    $users->where('role', 'like', '%' . $role . '%');
                }
                if ($working_at != null) {
                    $users->where('working_at', 'like', '%' . $working_at . '%');
                }
                if ($mobile != null) {
                    $users->where('mobile', 'like', '%' . $mobile . '%');
                }
                $users = $users->paginate(15);
                $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);
                // return $users;
                return view('pages.profileSearch', compact('users', 'title', 'links', 'type', 'corpsearchprofile', 'perPeople', 'perpeopleSkill'));
            } elseif ($type == 'company') {
                $users = Corpuser::with('user')->orderBy('id', 'desc');
                if ($name != null) {
                    $users->whereRaw("(firm_name like '%" . $name . "%' or firm_email_id = '" . $name . "')");
                }
                if ($city != null) {
                    $pattern = '/\\s*,\\s*/';
                    $replace = ',';
                    $city = preg_replace($pattern, $replace, $city);
                    $cityArray = explode(',', $city);
                    $users->whereIn('city', $cityArray);
                }
                if ($role != null) {
                    $users->where('role', 'like', '%' . $role . '%');
                }
                if ($firm_type != null) {
                    $users->whereIn('firm_type', $firm_type);
                }
                $users = $users->paginate(15);
                $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);
                $followCount = Follow::where('corporate_id', '=', Auth::user()->induser_id)->orWhere('individual_id', '=', Auth::user()->induser_id)->count('id');
                return view('pages.profileSearch', compact('users', 'title', 'following', 'type', 'followCount'));
            }
        }
    }