public function getActionAttribute() { $action = ReportAbuseAction::where('post', '=', $this->attributes['post_id'])->get(); return $action; }
public function unblockUserAfterAbuse($post_id) { if ($post_id != null) { if ($this->postExist($post_id)) { $user = Postjob::where('id', '=', $post_id)->first(['id', 'individual_id', 'corporate_id']); if ($user->individual_id != null) { $userId = User::where('induser_id', '=', $user->individual_id)->pluck('id'); User::where('induser_id', '=', $userId)->update(['inactive' => 0]); } elseif ($user->corporate_id != null) { $userId = User::where('corpuser_id', '=', $user->corporate_id)->pluck('id'); User::where('corpuser_id', '=', $userId)->update(['inactive' => 0]); } if ($this->postAbuseActionTaken($post_id) != false) { $tz = new \DateTimeZone('Asia/Kolkata'); $today = \Carbon\Carbon::now($tz); ReportAbuseAction::where('id', '=', $this->postAbuseActionTaken($post_id))->update(['post_user_blocked' => 0, 'user_blocked_dtTime' => $today]); } } } return redirect('/report-abuse'); }