/** * 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 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')); }
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')); } } }