Blame view

app/Classes/LikesClass.php 1.26 KB
dc2a9a876   Андрей Ларионов   Коммит на понедел...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
  <?php
  
  
  namespace App\Classes;
  
  
  use App\Models\Ad_employer;
  use App\Models\Like_vacancy;
  use App\Models\Like_worker;
  use App\Models\Worker;
  
  class LikesClass
  {
      // Вывод всех избранных вакансий у пользователя
      public static function ListVacancy(Ad_employer $ad_employer) {
          $ListVacancy = Like_vacancy::query()->where('code_record', '=', $ad_employer->id)->get();
          return $ListVacancy;
      }
  
      // Вывод всех избранных работников у пользователя
      public static function ListWorkers(Worker $worker) {
          $ListWorker = Like_worker::query()->where('code_record', '=', $worker->id)->get();
      }
  
      // Возвращение кода вакансии
      public static function get_status_vacancy(Ad_employer $ad_employer) {
          if (Like_vacancy::query()->where('code_record', '=', $ad_employer->id)->count() > 0)
              $IdVacancy = " active ";
          else
              $IdVacancy = "";
  
          return $IdVacancy;
      }
  
      public static function get_status_worker(Worker $worker) {
          if (Like_worker::query()->where('code_record', '=', $worker->id)->count() > 0)
          {  $IdWorker = " active"; } else { $IdWorker = "123"; }
  
          return $IdWorker;
      }
  }