Example #1
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()]);
     }
 }
Example #2
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>";
 }