/** * Execute the console command. * * @return mixed */ public function fire() { \Log::info('Expire notification started @ ' . \Carbon\Carbon::now()); $tz = new \DateTimeZone('Asia/Kolkata'); $today = \Carbon\Carbon::now($tz)->format('Y-m-d'); $posts = Postjob::where(DB::raw('date(post_expire_Dt)'), '=', $today)->get(['id', 'unique_id', 'individual_id', 'corporate_id']); foreach ($posts as $post) { if ($post->individual_id != null) { $uid = User::where('induser_id', '=', $post->individual_id)->pluck('id'); } else { if ($post->corporate_id != null) { $uid = User::where('corpuser_id', '=', $post->corporate_id)->pluck('id'); } } $notification = new Notification(); $notification->from_user = null; $notification->to_user = $uid; $notification->remark = 'Your post - ' . $post->unique_id . ' getting expired today.'; $notification->operation = 'job expire'; $notification->save(); } \Log::info('Expire notification ended @ ' . \Carbon\Carbon::now()); }
/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update($id) { $updatePost = Postjob::where('unique_id', '=', $id)->where('individual_id', '=', Auth::user()->induser_id)->first(); if ($updatePost != null) { $updatePost->post_title = Input::get('post_title'); $updatePost->job_detail = Input::get('job_detail'); $updatePost->industry = Input::get('industry'); $temp = explode('-', Input::get('role')); $updatePost->functional_area = $temp[0]; $updatePost->role = $temp[1]; $updatePost->time_for = Input::get('time_for'); $updatePost->education = implode(',', Input::get('education')); $updatePost->linked_skill = implode(',', Input::get('linked_skill_id')); $updatePost->min_exp = Input::get('min_exp'); $updatePost->min_sal = Input::get('min_sal'); $updatePost->max_sal = Input::get('max_sal'); $updatePost->city = implode(',', Input::get('prefered_location')); $pref_locations = Input::get('prefered_location'); $updatePost->website_redirect_url = Input::get('website_redirect_url'); $updatePost->resume_required = Input::get('resume_required'); $updatePost->show_contact = Input::get('show_contact'); $updatePost->save(); $preferedLocation = PostPreferredLocation::where('post_id', '=', $updatePost->id)->get(); foreach ($preferedLocation as $pl) { $pl->delete(); } foreach ($pref_locations as $loc) { $tempArr = explode('-', $loc); if (count($tempArr) == 3) { $updatePost->preferredLocation()->attach($loc, array('locality' => $tempArr[0], 'city' => $tempArr[1], 'state' => $tempArr[2])); } if (count($tempArr) == 2) { $updatePost->preferredLocation()->attach($loc, array('locality' => 'none', 'city' => $tempArr[0], 'state' => $tempArr[1])); } } return redirect('/mypost/single/' . $id); } else { return redirect('/mypost'); } }
/** * 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); }); }
public function sharePostByEmail(Request $request) { if ($request->ajax()) { $validator = Validator::make(['post_id' => $request['share_post_email_id'], 'email' => $request['sharetoemail']], ['post_id' => 'required', 'email' => 'required'], ['post_id' => 'Invalid post id.', 'email' => 'Please enter email id to share.']); if ($validator->fails()) { return response()->json(array('success' => false, 'errors' => $validator->getMessageBag()->toArray()), 500); } else { $isShared = 0; $sharePostId = $request['share_post_email_id']; $post = Postjob::findOrFail($sharePostId); $data = []; $data['email'] = ''; if ($post != null) { // share to link if ($request['sharetoemail'] != null) { $emails = $request['sharetoemail']; $emailArray = explode(', ', $emails); // $data['emails'] = $emailArray; foreach ($emailArray as $email) { $to_user = $email; if (Auth::user()->identifier == 1) { $from_user = Auth::user()->induser->fname; $post_user = Postjob::leftjoin('indusers', 'indusers.id', '=', 'postjobs.individual_id')->where('postjobs.id', '=', $sharePostId)->first(['indusers.fname']); } elseif (Auth::user()->identifier == 2) { $from_user = Auth::user()->corpuser->firm_name; $post_user = Postjob::leftjoin('corpusers', 'corpusers.id', '=', 'postjobs.corporate_id')->where('postjobs.id', '=', $sharePostId)->first(['corpusers.firm_name']); } if ($to_user != null) { Mail::send('emails.post-sharing', array('from_user' => $from_user, 'post' => $post, 'post_user' => $post_user), function ($message) use($to_user, $from_user) { $message->to($to_user, 'User')->subject($from_user . ' ' . 'has shared a Job Tip')->from('*****@*****.**', 'JobTip'); }); $data['email'] = $data['email'] . $to_user . ' - '; } } $isShared++; } // myactivity update if ($isShared > 0) { /*if($postActivity == null){ $postActivity = new Postactivity(); $postActivity->post_id = $sharePostId; $postActivity->user_id = Auth::user()->id; $postActivity->share = 1; $postActivity->share_dtTime = new \DateTime(); $postActivity->save(); }elseif($postActivity != null && $postActivity->share == 0){ $postActivity->share = 1; $postActivity->share_dtTime = new \DateTime(); $postActivity->save(); } $sharecount = Postactivity::where('post_id', '=', $sharePostId)->sum('share');*/ // $data['sharecount'] = $sharecount; $data['page'] = 'home'; } } return response()->json(['success' => true, 'data' => $data]); } } else { return redirect("/home"); } }
public function edit_view() { if (Auth::user()->identifier == 1) { $title = 'indprofile_edit'; $user = User::where('id', '=', Auth::user()->id)->with('induser')->first(); $skills = Skills::lists('name', 'name'); $thanks = Postactivity::with('user', 'post')->join('postjobs', 'postjobs.id', '=', 'postactivities.post_id')->where('postjobs.individual_id', '=', Auth::user()->induser_id)->where('postjobs.inactive', '=', 0)->where('postactivities.thanks', '=', 1)->orderBy('postactivities.id', 'desc')->sum('postactivities.thanks'); $posts = Postjob::where('individual_id', '=', Auth::user()->induser_id)->count('id'); $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'); $educationList = Education::orderBy('level')->orderBy('name')->where('name', '!=', '0')->get(); $location = Induser::where('id', '=', Auth::user()->induser_id)->first(['prefered_location']); // $loc = explode(',', $location); $farearoleList = Functional_area_role_mapping::orderBy('id')->get(); $acc_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); return view('pages.professional_page', compact('user', 'acc_id', 'title', 'skills', 'educationList', 'location', 'farearoleList', 'thanks', 'linksCount', 'posts', 'profilePer')); } else { if (Auth::user()->identifier == 2) { $title = 'corpprofile_edit'; $user = User::where('id', '=', Auth::user()->id)->with('corpuser')->first(); $skills = Skills::lists('name', 'name'); $acc_id = ""; return view('pages.firm_details', compact('user', 'title', 'skills', 'acc_id')); } } }
public function welcomeSkillPost($id) { $title = 'Post_details'; $post = Postjob::orderBy('id', 'desc')->with('indUser', 'corpUser')->where('unique_id', '=', $id)->get(); if ($post != null) { $post = $post->first(); } return view('pages.welcome_postdetails', compact('post', 'title')); }
public function postFilter(Request $request) { $title = 'home'; $sort_by = " "; $sort_by_skill = " "; $skillfilter = ""; $skills = Skills::lists('name', 'name'); $filter = Filter::where('from_user', '=', Auth::user()->id)->where('post_type', '=', 'job')->first(); $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); $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'); 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()->corpuser_id != null) { $following = DB::select('select id from indusers where indusers.id in ( select follows.individual_id as id from follows where follows.corporate_id=? )', [Auth::user()->corpuser_id]); $following = collect($following); } 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'); } $skillPosts = Postjob::orderBy('id', 'desc')->with('indUser', 'corpUser', 'postActivity', 'taggedUser', 'taggedGroup')->where('post_type', '=', 'skill')->where('individual_id', '!=', Auth::user()->induser_id)->where('postjobs.inactive', '=', 0)->paginate(15); // $post_type = $request['post_type']; $post_title = $request['jobTitle']; $experience = $request['experience']; $time_for = $request['time_for']; $skill = $request['jobSkill'] != null ? implode(',', $request['jobSkill']) : null; $industry = $request['industry']; // return $skill; $jobPosts = Postjob::orderBy('postjobs.id', 'desc')->with('indUser', 'corpUser', 'postActivity', 'preferLocations')->leftjoin('post_preferred_locations', 'post_preferred_locations.post_id', '=', 'postjobs.id')->where('individual_id', '!=', Auth::user()->induser_id)->where('inactive', '=', 0); if ($time_for != null) { $jobPosts->whereIn('time_for', $time_for); } /*if($post_type == 'job'){ $jobPosts->where('post_type', '=', $post_type); }*/ if ($skill != null) { $jobPosts->where('linked_skill', 'like', '%' . $skill . '%'); } if ($post_title != null) { $jobPosts->where('post_title', 'like', '%' . $post_title . '%')->whereRaw("(job_detail like '%" . $post_title . "%' or role like '%" . $post_title . "%' or linked_skill like '%" . $post_title . "%')"); } if ($industry != null) { $jobPosts->where('industry', 'like', '%' . $industry . '%'); } if ($experience != null) { $jobPosts->whereRaw("{$experience} between min_exp and max_exp"); } $jobPosts = $jobPosts->groupBy('unique_id')->paginate(15); // return $jobPosts; return view('pages.homeFiltered', compact('jobPosts', 'skillPosts', 'linksApproval', 'linksPending', 'title', 'links', 'groups', 'following', 'userSkills', 'skills', 'share_links', 'share_groups', 'sort_by', 'sort_by_skill', 'filter', 'skillfilter', 'submitFilter')); }
public function accountDelete() { if (Auth::user()->identifier == 1) { $title = "AccountSetting"; $acc_id = Input::get('account_id'); $password = bcrypt(Input::get('password')); $skills = Skills::lists('name', 'name'); $thanks = Postactivity::with('user', 'post')->join('postjobs', 'postjobs.id', '=', 'postactivities.post_id')->where('postjobs.individual_id', '=', Auth::user()->induser_id)->where('postjobs.inactive', '=', 0)->where('postactivities.thanks', '=', 1)->orderBy('postactivities.id', 'desc')->sum('postactivities.thanks'); $posts = Postjob::where('individual_id', '=', Auth::user()->induser_id)->count('id'); $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'); $educationList = Education::orderBy('level')->orderBy('name')->where('name', '!=', '0')->get(); $location = Induser::where('id', '=', Auth::user()->induser_id)->first(['prefered_location']); $farearoleList = Functional_area_role_mapping::orderBy('id')->get(); $userDetail = User::where('induser_id', '=', Auth::user()->induser_id)->first(); $token = 'AD' . rand(11111, 99999) . rand(11111, 99999); if (Hash::check(Input::get('password'), $userDetail->password)) { $user = User::with('induser')->where('id', '=', Auth::user()->id)->first(); return view('pages.professional_page', compact('title', 'user', 'acc_id', 'skills', 'educationList', 'location', 'farearoleList', 'thanks', 'linksCount', 'posts')); } else { return redirect('/mypost'); } } elseif (Auth::user()->identifier == 2) { $title = "AccountSetting"; $acc_id = Input::get('account_id'); $password = bcrypt(Input::get('password')); $skills = Skills::lists('name', 'name'); $userDetail = User::where('corpuser_id', '=', Auth::user()->corpuser_id)->first(); $token = 'AD' . rand(11111, 99999) . rand(11111, 99999); if (Hash::check(Input::get('password'), $userDetail->password)) { $user = User::with('corpuser')->where('id', '=', Auth::user()->id)->first(); return view('pages.firm_details', compact('title', 'user', 'acc_id', 'skills')); } else { return redirect('/mypost'); } } }