Exemplo n.º 1
0
 public function testGuzzle(CompanyService $company)
 {
     /*$client = new GuzzleClient();
       $response = $client->request('GET', 'https://maps.googleapis.com/maps/api/geocode/json?address=Horsholmsgade 22C, 1th. Kobenhavnn&key=AIzaSyCThnvUY6ZAV7JakXbKE5Mw8QSdJ4Fa06U');
       $data = json_decode($response->getBody()->getContents(),true);
       echo "<pre>";
           print_r($data['results'][0]['geometry']);
           print_r($data['status']);
       echo "</pre>";*/
     /*$job_post_created_date = date('Y-m-d',strtotime('2016-09-01'));
             // $job_post_end_date = date('Y-m-d', strtotime('+30 days',strtotime($job_post_created_date)));
             $job_post_end_date = date('Y-m-d', strtotime('2016-09-15'));
             echo $job_post_created_date . ' to ' . $job_post_end_date . '<br/>';
             $from = date_create($job_post_created_date);
             $to = date_create($job_post_end_date);
             $date_diff = date_diff($from,$to);
             echo $date_diff->format("%a") . '<br/>';
             $date_diff_result = (int) $date_diff->format("%a");
     
             $date_lists = [];
     
             for($x = 0 ; $x <= $date_diff_result ; $x++) {
                 $date_lists[] = [
                     date('Y-m-d', strtotime("+$x days",strtotime($job_post_created_date))),
                     0
                 ];
             }*/
     /*echo "<pre>";
       print_r($date_lists);
       echo "</pre>";*/
     // $viewed_dates = CompanyJobView::select(DB::raw('DATE(created_at) as created_date'),DB::raw('COUNT(*) as count'))->where('job_id','=',3)->groupBy('created_date')->get()->toArray();
     // $viewed_dates = CompanyApplyJob::select(DB::raw('DATE(created_at) as created_date'),DB::raw('COUNT(*) as count'))->where('job_id','=',3)->groupBy('created_date')->get()->toArray();
     /*$viewed_dates = CompanyJobMatch::select('match_count_date as created_date','match_count as count')->where('job_id','=',3)->groupBy('created_date')->get()->toArray();
       echo "<pre>";
       print_r($viewed_dates);
       echo "</pre>";*/
     /*foreach ($date_lists as $key => $date_list) {
                 foreach ($viewed_dates as $viewed_date) {
                     if($date_list[0] == $viewed_date['created_date']) {
                         $date_lists[$key][1] = $viewed_date['count'];
                     }
                 }
             }
     
             echo "<pre>";
             print_r($date_lists);
             echo "</pre>";*/
     echo "<pre></br>";
     echo "Job Post Views</br>";
     print_r($company->getDailyJobPostViews(3));
     echo "Job Post Matches</br>";
     print_r($company->getDailyJobPostMatches(3));
     echo "Job Post Applicants</br>";
     print_r($company->getDailyJobPostApplicants(3));
     echo "</pre>";
 }
Exemplo n.º 2
0
 public function getJobPostStatistics(CompanyService $company, $user_id, $company_id, $job_id)
 {
     try {
         $response = ['date_lists' => $company->getDateLists($job_id), 'views' => $company->getDailyJobPostViews($job_id), 'matches' => $company->getDailyJobPostMatches($job_id), 'applicants' => $company->getDailyJobPostApplicants($job_id)];
         return $this->json_response->success($response);
     } catch (Exception $e) {
         return $this->json_response->error(['error' => $e->getMessage()]);
     }
 }
Exemplo n.º 3
0
 public function getUserPageDefaults(UserService $user, CompanyService $company, ConversationService $conversation, $user_id)
 {
     try {
         $data = ['conversation_count' => $conversation->getUnreadConversationCountBySenderReceiverId($user_id)];
         if (Request::has('user_has_company') && Request::get('user_has_company')) {
             $company_information = $company->getCompanyByUserId($user_id);
             $job_ids = $company->retrieveJobPostsByCompanyId($company_information['id']);
             $data['applied_count'] = $company->getApplicantCountByJobIds($job_ids);
         } else {
             $user_skills = $user->getAllUserSkills($user_id);
             $skill_ids = [];
             $job_ids = [];
             $job_posts = [];
             foreach ($user_skills as $skill_info) {
                 $skill_ids[] = $skill_info['skill_id'];
             }
             if (count($skill_ids) > 0) {
                 $banned_job_ids = $user->getBannedJobs($user_id);
                 $job_ids = [];
                 if (count($banned_job_ids) == 0) {
                     $job_ids = $company->getJobPostBySkills($skill_ids);
                 } else {
                     $job_ids = $company->getNotBannedJobPostBySkills($skill_ids, $banned_job_ids);
                 }
                 if (count($job_ids) > 0) {
                     $job_posts = $company->getCompanyJobPostByJobId($job_ids);
                 }
             }
             $data['job_match_count'] = count($job_posts);
             $data['verification_status'] = $user->checkUserVerified($user_id);
         }
         return $this->json_response->success($data);
     } catch (Exception $e) {
         return $this->json_response->error(['error' => $e->getMessage()]);
     }
 }
Exemplo n.º 4
0
 public function updateCompanyJobSkillImportance(CompanyService $company, $user_id, $company_id, $job_id, $skill_id = null)
 {
     $retrieve = ['importance', 'type'];
     try {
         $input = Request::only($retrieve);
         if ($input['type'] == 'skill') {
             $response = $company->updateCompanyJobSkillImportance($skill_id, $input);
         } else {
             $response = $company->updateCompanyJobTraitImportance($job_id, $input['importance']);
         }
         if (!empty($response)) {
             return $this->json_response->success($response);
         }
         return $this->json_response->error($response);
     } catch (Exception $e) {
         return $this->json_response->error(['error' => $e->getMessage()]);
     }
 }
Exemplo n.º 5
0
 public function approveCompany(CompanyService $company, $company_id)
 {
     try {
         $response = $company->approveCompany($company_id);
         return $this->json_response->success($response);
     } catch (Exception $e) {
         return $this->json_response->error(['error' => $e->getMessage()]);
     }
 }