Пример #1
0
 public function followers()
 {
     $title = 'followers';
     $followers = Corpuser::find(Auth::user()->corpuser_id)->followers;
     return view('pages.connections', compact('title', 'followers'));
 }
Пример #2
0
 /**
  * Bootstrap the application services.
  *
  * @return void
  */
 public function boot()
 {
     view()->composer('includes-update.header', function ($view) {
         $thanksCount = 0;
         $followCount = 0;
         if (Auth::user()->identifier == 1 || Auth::user()->identifier == 3) {
             $user = Induser::where('id', '=', Auth::user()->induser_id)->first();
             $favourites = Postactivity::with('user')->where('fav_post', '=', 1)->where('user_id', '=', Auth::user()->id)->orderBy('id', 'desc')->get(['id', 'fav_post', 'fav_post_dtTime', 'user_id', 'post_id']);
             $thanksCount = Postactivity::with('user', 'post')->join('postjobs', 'postjobs.id', '=', 'postactivities.post_id')->where('postjobs.individual_id', '=', Auth::user()->induser_id)->where('postactivities.thanks', '=', 1)->orderBy('postactivities.id', 'desc')->sum('postactivities.thanks');
             $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');
             $groupCount = Groups_users::where('user_id', '=', Auth::user()->induser_id)->count('id');
             $postCount = Postjob::where('individual_id', '=', Auth::user()->induser_id)->count('id');
             $profilePer = 0;
             if (Auth::user()->induser->fname != null) {
                 $profilePer = $profilePer + 1;
             }
             if (Auth::user()->induser->lname != null) {
                 $profilePer = $profilePer + 1;
             }
             if (Auth::user()->induser->email != null) {
                 $profilePer = $profilePer + 1;
             }
             if (Auth::user()->induser->mobile != null) {
                 $profilePer = $profilePer + 1;
             }
             if (Auth::user()->induser->dob != null) {
                 $profilePer = $profilePer + 1;
             }
             if (Auth::user()->induser->city != null) {
                 $profilePer = $profilePer + 1;
             }
             if (Auth::user()->induser->fb_page != null) {
                 $profilePer = $profilePer + 1;
             }
             if (Auth::user()->induser->in_page != null) {
                 $profilePer = $profilePer + 1;
             }
             if (Auth::user()->induser->gender != null) {
                 $profilePer = $profilePer + 1;
             }
             if (Auth::user()->induser->about_individual != null) {
                 $profilePer = $profilePer + 1;
             }
             if (Auth::user()->induser->education != null) {
                 $profilePer = $profilePer + 1;
             }
             if (Auth::user()->induser->experience != null) {
                 $profilePer = $profilePer + 1;
             }
             if (Auth::user()->induser->working_status != null) {
                 $profilePer = $profilePer + 1;
             }
             if (Auth::user()->induser->working_at != null) {
                 $profilePer = $profilePer + 1;
             }
             if (Auth::user()->induser->role != null) {
                 $profilePer = $profilePer + 1;
             }
             if (Auth::user()->induser->linked_skill != null) {
                 $profilePer = $profilePer + 1;
             }
             if (Auth::user()->induser->resume != null) {
                 $profilePer = $profilePer + 1;
             }
             if (Auth::user()->induser->prefered_location != null) {
                 $profilePer = $profilePer + 1;
             }
             if (Auth::user()->induser->prefered_jobtype != null) {
                 $profilePer = $profilePer + 1;
             }
             if (Auth::user()->induser->profile_pic != null) {
                 $profilePer = $profilePer + 1;
             }
             $profilePer = round($profilePer / 20 * 100);
         } else {
             if (Auth::user()->identifier == 2 || Auth::user()->identifier == 3) {
                 $user = Corpuser::where('id', '=', Auth::user()->corpuser_id)->first();
                 $followCount = Follow::where('corporate_id', '=', 1)->orWhere('individual_id', '=', 1)->count('id');
                 $linksCount = "";
                 $linkrequestCount = "";
                 $groupCount = "";
                 $postCount = Postjob::where('corporate_id', '=', Auth::user()->corpuser_id)->count('id');
                 $favourites = Postactivity::with('user')->where('fav_post', '=', 1)->where('user_id', '=', Auth::user()->id)->orderBy('id', 'desc')->get(['id', 'fav_post', 'fav_post_dtTime', 'user_id', 'post_id']);
                 $profilePer = 0;
                 if (Auth::user()->corpuser->firm_name != null) {
                     $profilePer = $profilePer + 1;
                 }
                 if (Auth::user()->corpuser->username != null) {
                     $profilePer = $profilePer + 1;
                 }
                 if (Auth::user()->corpuser->firm_type != null) {
                     $profilePer = $profilePer + 1;
                 }
                 if (Auth::user()->corpuser->emp_count != null) {
                     $profilePer = $profilePer + 1;
                 }
                 if (Auth::user()->corpuser->working_as != null) {
                     $profilePer = $profilePer + 1;
                 }
                 if (Auth::user()->corpuser->slogan != null) {
                     $profilePer = $profilePer + 1;
                 }
                 if (Auth::user()->corpuser->firm_email_id != null) {
                     $profilePer = $profilePer + 1;
                 }
                 if (Auth::user()->corpuser->logo_status != null) {
                     $profilePer = $profilePer + 1;
                 }
                 if (Auth::user()->corpuser->about_firm != null) {
                     $profilePer = $profilePer + 1;
                 }
                 if (Auth::user()->corpuser->firm_address != null) {
                     $profilePer = $profilePer + 1;
                 }
                 if (Auth::user()->corpuser->operating_since != null) {
                     $profilePer = $profilePer + 1;
                 }
                 if (Auth::user()->corpuser->linked_skill != null) {
                     $profilePer = $profilePer + 1;
                 }
                 if (Auth::user()->corpuser->website_url != null) {
                     $profilePer = $profilePer + 1;
                 }
                 if (Auth::user()->corpuser->firm_phone != null) {
                     $profilePer = $profilePer + 1;
                 }
                 if (Auth::user()->corpuser->industry != null) {
                     $profilePer = $profilePer + 1;
                 }
                 if (Auth::user()->corpuser->role != null) {
                     $profilePer = $profilePer + 1;
                 }
                 if (Auth::user()->corpuser->city != null) {
                     $profilePer = $profilePer + 1;
                 }
                 $profilePer = round($profilePer / 17 * 100);
             }
         }
         $view->with('session_user', $user)->with('favourites', $favourites)->with('thanksCount', $thanksCount)->with('followCount', $followCount)->with('profilePer', $profilePer)->with('linkrequest', $linkrequestCount)->with('linkCount', $linksCount)->with('groupCount', $groupCount)->with('postCount', $postCount);
     });
     view()->composer('includes-update.header', function ($view) {
         if (Auth::user()->identifier == 1 || Auth::user()->identifier == 2 || Auth::user()->identifier == 3) {
             $applications = Postactivity::with('user', 'post')->join('postjobs', 'postjobs.id', '=', 'postactivities.post_id')->where('postjobs.individual_id', '=', Auth::user()->induser_id)->where('postactivities.apply', '=', 1)->orderBy('postactivities.id', 'desc')->take(5)->get(['postactivities.id', 'postjobs.unique_id', 'postactivities.apply', 'postactivities.apply_dtTime', 'postactivities.user_id', 'postactivities.post_id']);
             $thanks = Postactivity::with('user', 'post')->join('postjobs', 'postjobs.id', '=', 'postactivities.post_id')->where('postjobs.individual_id', '=', Auth::user()->induser_id)->where('postactivities.thanks', '=', 1)->orderBy('postactivities.id', 'desc')->take(5)->get();
             $favourites = Postactivity::with('user')->where('fav_post', '=', 1)->where('user_id', '=', Auth::user()->id)->orderBy('id', 'desc')->get(['id', 'fav_post', 'fav_post_dtTime', 'user_id', 'post_id']);
             $thanksCount = Postactivity::with('user', 'post')->join('postjobs', 'postjobs.id', '=', 'postactivities.post_id')->where('postjobs.individual_id', '=', Auth::user()->induser_id)->where('postactivities.thanks', '=', 1)->orderBy('postactivities.id', 'desc')->sum('postactivities.thanks');
             $applicationsCount = Postactivity::with('user', 'post')->join('postjobs', 'postjobs.id', '=', 'postactivities.post_id')->where('postjobs.individual_id', '=', Auth::user()->induser_id)->where('postactivities.apply', '=', 1)->orderBy('postactivities.id', 'desc')->sum('postactivities.apply');
             $notifications = Notification::with('fromUser', 'toUser')->where('to_user', '=', Auth::user()->id)->orderBy('id', 'desc')->take(5)->get();
             $notificationsCount = Notification::where('to_user', '=', Auth::user()->id)->where('view_status', '=', 0)->count();
         }
         $view->with('applications', $applications)->with('thanks', $thanks)->with('favourites', $favourites)->with('thanksCount', $thanksCount)->with('applicationsCount', $applicationsCount)->with('notifications', $notifications)->with('notificationsCount', $notificationsCount);
     });
 }
Пример #3
0
 public function addresscorporateUpdate(Request $request)
 {
     $addressupdate = Corpuser::where('id', '=', $request['userid'])->first();
     if ($addressupdate != null) {
         $addressupdate->address_1 = $request['address_1'];
         $addressupdate->address_2 = $request['address_2'];
         $addressupdate->city = $request['city'];
         $addressupdate->save();
         return response()->json(['success' => 'success']);
     } else {
         return response()->json(['success' => 'fail']);
     }
 }
Пример #4
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'));
 }
Пример #5
0
    public function postedByCorp($id)
    {
        if (Auth::check()) {
            $title = 'postByCorporate';
            $groups = array();
            $postCorp = Corpuser::find($id);
            $filter = Filter::where('post_type', '=', 'job')->where('from_user', '=', Auth::user()->id)->first();
            $skillfilter = Filter::where('from_user', '=', Auth::user()->id)->where('post_type', '=', 'skill')->first();
            $jobPosts = Postjob::orderBy('id', 'desc')->with('indUser', 'corpUser', 'postActivity', 'taggedUser', 'taggedGroup')->where('post_type', '=', 'job')->where('corporate_id', '=', $id)->where('inactive', '=', 0)->paginate(15);
            $skillPosts = Postjob::orderBy('id', 'desc')->with('indUser', 'corpUser', 'postActivity', 'taggedUser', 'taggedGroup')->where('post_type', '=', 'skill')->where('individual_id', '!=', Auth::user()->induser_id)->where('inactive', '=', 0)->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);
            $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);
            $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);
            if (Auth::user()->identifier == 1) {
                $share_links = Induser::whereRaw('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])->get(['id', 'fname'])->lists('fname', 'id');
                $share_groups = Group::leftjoin('groups_users', 'groups_users.group_id', '=', 'groups.id')->where('groups.admin_id', '=', Auth::user()->induser_id)->orWhere('groups_users.user_id', '=', Auth::user()->induser_id)->groupBy('groups.id')->get(['groups.id as id', 'groups.group_name as name'])->lists('name', 'id');
            }
            $groups = Group::leftjoin('groups_users', 'groups_users.group_id', '=', 'groups.id')->where('groups.admin_id', '=', Auth::user()->induser_id)->orWhere('groups_users.user_id', '=', Auth::user()->induser_id)->groupBy('groups.id')->get(['groups.id as id'])->lists('id');
            $skills = Skills::lists('name', 'id');
            if (Auth::user()->induser_id != null) {
                $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 (Auth::user()->identifier == 1) {
                $userSkills = Induser::where('id', '=', Auth::user()->induser_id)->first(['linked_skill']);
                $userSkills = array_map('trim', explode(',', $userSkills->linked_skill));
                unset($userSkills[count($userSkills) - 1]);
            }
            return view('pages.home', compact('jobPosts', 'share_links', 'share_groups', 'skillPosts', 'linksPending', 'linksApproval', 'title', 'links', 'groups', 'following', 'userSkills', 'skills', 'postCorp', 'filter', 'skillfilter'));
            // return $userSkills;
        } else {
            return redirect('login');
        }
    }
Пример #6
0
 public function deleteProfileAccount()
 {
     if (Auth::user()->identifier == 1) {
         $user = User::where('induser_id', '=', Auth::user()->induser_id)->first();
         $induser = Induser::where('id', '=', Auth::user()->induser_id)->first();
         $accountDetail = new Accountdetail();
         $accountDetail->name = $user->name;
         $accountDetail->emailid = $user->email;
         $accountDetail->mobile = $user->mobile;
         $accountDetail->profile_created_date = $user->created_at;
         $accountDetail->reason = Input::get('reason');
         $accountDetail->comments = Input::get('comments');
         $accountDetail->save();
         if ($accountDetail != null) {
             $user->delete();
             $induser->delete();
         }
     } elseif (Auth::user()->identifier == 2) {
         $user = User::where('corpuser_id', '=', Auth::user()->corpuser_id)->first();
         $corpuser = Corpuser::where('id', '=', Auth::user()->corpuser_id)->first();
         $accountDetail = new Accountdetail();
         $accountDetail->name = $user->name;
         $accountDetail->emailid = $user->email;
         $accountDetail->mobile = $user->mobile;
         $accountDetail->profile_created_date = $user->created_at;
         $accountDetail->reason = Input::get('reason');
         $accountDetail->comments = Input::get('comments');
         $accountDetail->save();
         if ($accountDetail != null) {
             $user->delete();
             $corpuser->delete();
         }
     }
     return redirect('/auth/logout');
 }