Поиск разблокированных - PHP Online

Form of PHP Sandbox

Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php in the places where the PHP script should be executed.

Name: Поиск разблокированных fullscreencopydownloadembedprint


Your result can be seen below.

Result of php executing





Full code of Поиск разблокированных.php

  1.  $hisories = PersonSyncHistory::query()
  2.             ->with('event')
  3.             ->whereHas('event', function ($query) {
  4.                 $query->whereIn('code', LeadSyncStatus::BLOCK_EVENTS);
  5.             })
  6.             ->orderBy('created_at', 'ASC')
  7.             ->get()
  8.             ->groupBy(['user_id']);
  9.         $count = 0;
  10.  
  11.         $batch = [];
  12.         foreach ($hisories as $users) {
  13.             $reserve = true;
  14.             foreach ($users as $user) {
  15.                 if ($user->event->code == 18 || $user->event->code == 19 || $user->event->code == 20 || $user->event->code == 21 || $user->event->code == 22 || $user->event->code == 23) {
  16.                     $reserve = false;
  17.                 }
  18.                 if ($reserve == false && ($user->event->code == 6 || $user->event->code == 7 || $user->event->code == 8 || $user->event->code == 9 || $user->event->code == 10 || $user->event->code == 11)) {
  19.                     $count++;
  20.                     dd($user);
  21.                     $batch[] = $users;
  22.                     file_put_contents('lead-reserv.txt', "{$user->user->full_name}\n", FILE_APPEND);
  23.                     break;
  24.                 }
  25.             }
  26.         }
  27.         dd($count);
File Description
  • Поиск разблокированных
  • PHP Code
  • 16 Sep-2021
  • 1.17 Kb
You can Share it: