src/Controller/HomeController.php line 36

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Enum\BasicEnum;
  4. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  5. use Symfony\Component\HttpFoundation\JsonResponse;
  6. use Symfony\Component\HttpFoundation\Response;
  7. use Symfony\Component\HttpFoundation\Session\Session;
  8. use Symfony\Component\Routing\Annotation\Route;
  9. use Symfony\Component\Security\Core\Security;
  10. use App\Entity\Media;
  11. use App\Entity\Detections;
  12. use Doctrine\Persistence\ManagerRegistry;
  13. use App\Service\ChartsService;
  14. use App\Service\DataType;
  15. class HomeController extends AbstractController
  16. {
  17.     private $security;
  18.     private $doctrine;
  19.     private $charts;
  20.     public function __construct(
  21.         ManagerRegistry $doctrine,
  22.         Security $security,
  23.         ChartsService $charts
  24.     )
  25.     {
  26.         $this->doctrine $doctrine;
  27.         $this->security $security;
  28.         $this->charts $charts;
  29.        
  30.     }
  31.     #[Route('/'name'app_home')]
  32.     public function index(ManagerRegistry $doctrine): Response
  33.     {
  34.         $session = new Session();
  35.         //$session->start();
  36.         $user $this->security->getUser();
  37.         $medias $doctrine->getRepository(Media::class)->findBy(['createdBy'=>$user]);
  38.         if (!$medias) {
  39.            
  40.             $session->getFlashBag()->add(
  41.                 'warning',
  42.                 '<h4 class="alert-heading">Welcome !</h4>To proceed, first create a new media profile.'
  43.             );
  44.             return $this->redirectToRoute('new_media');
  45.         }else{
  46.          //generating data
  47.          $countries BasicEnum::getEnumAsArray('App\Enum\Additionnal\Country''');
  48.          $today=new \DateTime();
  49.          //yesterday
  50.          $yesterday $today->modify("-1 days");
  51.          $dateRange = ['from'=>$yesterday'to' => new \DateTime()] ;
  52.          //yestermonth
  53.          $yestermonth = (new \DateTime())->sub( ( new \DateInterval('P1M')))->format('m');
  54.          //! fin initialisation parameters
  55.          $todayDetections $this->doctrine->getManager()->getRepository(Detections::class)->findDetections(nullnullfalsenullnullnull, ['from'=> new \DateTime(), 'to' => new \DateTime()], falsefalsefalsenull$this->security->getUser());
  56.          $todayConsumers $this->doctrine->getManager()->getRepository(Detections::class)->findDetections(nullnullfalsenullnullnull, ['from'=> new \DateTime(), 'to' => new \DateTime()], falsetruefalsenull$this->security->getUser());
  57.          $to7daysDetections $this->doctrine->getManager()->getRepository(Detections::class)->findDetections(nullnull falsefalse'P7D'nullnullfalsefalsefalsenull$this->security->getUser(), true);
  58.          $to7daysConsumers $this->doctrine->getManager()->getRepository(Detections::class)->findDetections(nullnull falsefalse'P7D'nullnullfalsetruefalsenull$this->security->getUser(), true);
  59.          $yester7daysDetections $this->doctrine->getManager()->getRepository(Detections::class)->findDetections(nullnull falsefalse'P14D'nullnullfalsefalsefalsenull$this->security->getUser(), true );
  60.          $yester7daysConsumers $this->doctrine->getManager()->getRepository(Detections::class)->findDetections(nullnull falsefalse'P14D'nullnullfalsetruefalsenull$this->security->getUser(), true);
  61.          $todayTopMediasDetections $this->doctrine->getManager()->getRepository(Detections::class)->getTopMediasAndSpots(falsetrue $this->security->getUser(), falsenull, ['from'=> new \DateTime(), 'to' => new \DateTime()]);
  62.          $todayTopMediasConsumers $this->doctrine->getManager()->getRepository(Detections::class)->getTopMediasAndSpots(falsetrue $this->security->getUser(), truenull, ['from'=> new \DateTime(), 'to' => new \DateTime()]);
  63.          $todayTopSpotsDetections $this->doctrine->getManager()->getRepository(Detections::class)->getTopMediasAndSpots(truefalse $this->security->getUser(), falsenull, ['from'=> new \DateTime(), 'to' => new \DateTime()]);
  64.          $todayTopSpotsConsumers $this->doctrine->getManager()->getRepository(Detections::class)->getTopMediasAndSpots(truefalse $this->security->getUser(), truenull, ['from'=> new \DateTime(), 'to' => new \DateTime()]);
  65.          $todayConsumersbyCountry  $this->doctrine->getManager()->getRepository(Detections::class)->findDetections(falsefalsetruenullnullnull, ['from'=> new \DateTime(), 'to' => new \DateTime()], falsetruefalsenull$this->security->getUser(), false);
  66.          $toDayWorldMapConsumers $this->charts->getMapAreas(array_column($todayConsumersbyCountry"nbrConsumers""country"), "Consumers"$countries);
  67.          $todayConsumersbyRegion  $this->doctrine->getManager()->getRepository(Detections::class)->findDetections(falsefalsetruetruenullnull, ['from'=> new \DateTime(), 'to' => new \DateTime()], falsetruefalsenull$this->security->getUser(), false );
  68.          $todayConsumersbyOs  $this->doctrine->getManager()->getRepository(Detections::class)->findDetections(nullfalsefalsefalsenullnull, ['from'=> new \DateTime(), 'to' => new \DateTime()], truetruefalsenull$this->security->getUser(), false);
  69.          $toDayDoughnutConsumersChart $this->charts->generateDoughnutChart($todayConsumersbyOs"nbrConsumers""nbrOsDetections"DataType::Consumers"os");
  70.          $todayConsumersbyDeviceType  $this->doctrine->getManager()->getRepository(Detections::class)->findDetections(nullfalsefalsefalsenullnull, ['from'=> new \DateTime(), 'to' => new \DateTime()], falsetruetruenull$this->security->getUser(), false);
  71.          $toDayBarConsumersChart $this->charts->generateBarChart($todayConsumersbyDeviceType"nbrConsumers""nbrDeviceDetections"DataType::Consumers"deviceType");
  72.          //Charts
  73.          $chart7daysConsumers $this->charts->generateLineChart(
  74.             $period = ['from' => (new \DateTime())->modify("-7 days"), 'to' => new \DateTime()],[
  75.                 ['label' => 'Last 7 days Consumers','data'=>$this->charts->prepareForCharts($to7daysConsumers"nbrConsumers"$period)], 
  76.         ['label' => 'The 7 days before Consumers',"borderDash" => [55], "color" => "#8ca1ca"'data'=>$this->charts->prepareForCharts($yester7daysConsumers"nbrConsumers",  ['from' => (new \DateTime())->modify("-14 days"), 'to' => (new \DateTime())->modify("-7 days")])]
  77.     ],"Consumers"null
  78.         );
  79.         $chart7daysDetections $this->charts->generateLineChart(
  80.             $period = ['from' => (new \DateTime())->modify("-7 days"), 'to' => new \DateTime()],[
  81.                 ['label' => 'Last 7 days Consumers','data'=>$this->charts->prepareForCharts($to7daysDetections"nbrUserDetections"$period)], 
  82.         ['label' => 'The 7 days before Consumers',"borderDash" => [55], "color" => "#8ca1ca"'data'=>$this->charts->prepareForCharts($yester7daysDetections"nbrUserDetections",  ['from' => (new \DateTime())->modify("-14 days"), 'to' => (new \DateTime())->modify("-7 days")])]
  83.     ],"Detections"null
  84.         );
  85.         return $this->render('home/index.html.twig', [
  86.             'countries' => array_flip($countries),
  87.             'chart7daysConsumers'=>$chart7daysConsumers,
  88.             'chart7daysDetections'=>$chart7daysDetections,
  89.             'todayDetections' => $todayDetections,
  90.             'todayConsumers'=> $todayConsumers,
  91.             'topMediasByDetections'=>$todayTopMediasDetections,
  92.             'consumersTopMediasTable'=>$todayTopMediasConsumers,
  93.             //'mediasByDetections'=>$todayTopMediasDetections,
  94.             'consumersByMediasTable'=>$todayTopMediasConsumers,
  95.             //'spotsByDetections' => $todayTopSpotsDetections,
  96.             'consumersBySpotsTable' => $todayTopSpotsConsumers,
  97.             //'topSpotsByDetections' => $todayTopSpotsDetections,
  98.             'consumersTopSpotsTable' => $todayTopSpotsConsumers,
  99.             'consumersByCountry'=>$todayConsumersbyCountry,
  100.             'consumersTopCountry'=>$todayConsumersbyCountry,
  101.             'worldMapConsumers'=>$toDayWorldMapConsumers,
  102.             'consumersbyRegion'=>$todayConsumersbyRegion,
  103.             'doughnutConsumersChart'=>$toDayDoughnutConsumersChart,
  104.             'barConsumersChart'=>$toDayBarConsumersChart
  105.           
  106.         ]);
  107.     }
  108.     }
  109.     #[Route('/period/{period}'methods:"GET"name'update_home')]
  110.     public function updateHome($period
  111.     {
  112.         //initialisation
  113.         $countries BasicEnum::getEnumAsArray('App\Enum\Additionnal\Country''');
  114.          //today is
  115.          $today=new \DateTime();
  116.          //yesterday
  117.          $yesterday $today->modify("-1 days");
  118.          $dateRange = ['from'=>$yesterday'to' => new \DateTime()] ;
  119.          //yestermonth
  120.          $yestermonth = (new \DateTime())->sub( ( new \DateInterval('P1M')))->format('m');
  121.          //general
  122.         //  $todayDetections = $this->doctrine->getManager()->getRepository(Detections::class)->getMediaTotalDetectionsPeriod($media, 'P1D');
  123.         $todayConsumers $this->doctrine->getManager()->getRepository(Detections::class)->findDetections(nullnullfalsenullnullnull, ['from'=> new \DateTime(), 'to' => new \DateTime()], falsetruefalsenull$this->security->getUser());
  124.         switch ($period) {
  125.             case "today":
  126.                 //Today
  127.         
  128.                 $todayConsumers $this->doctrine->getManager()->getRepository(Detections::class)->findDetections(nullnullfalsenullnullnull, ['from'=> new \DateTime(), 'to' => new \DateTime()], falsetruefalsenull$this->security->getUser());
  129.                 $todayTopMediasConsumers $this->doctrine->getManager()->getRepository(Detections::class)->getTopMediasAndSpots(falsetrue $this->security->getUser(), truenull, ['from'=> new \DateTime(), 'to' => new \DateTime()]);
  130.                 $todayTopSpotsConsumers $this->doctrine->getManager()->getRepository(Detections::class)->getTopMediasAndSpots(truefalse $this->security->getUser(), truenull, ['from'=> new \DateTime(), 'to' => new \DateTime()]);
  131.                 $todayConsumersbyCountry  $this->doctrine->getManager()->getRepository(Detections::class)->findDetections(falsefalsetruenullnullnull, ['from'=> new \DateTime(), 'to' => new \DateTime()], falsetruefalsenull$this->security->getUser(), false);
  132.                 $toDayWorldMapConsumers $this->charts->updateMapAreas($todayConsumersbyCountryarray_flip($countries), DataType::Consumers);
  133.                 $todayConsumersbyRegion  $this->doctrine->getManager()->getRepository(Detections::class)->findDetections(falsefalsetruetruenullnull, ['from'=> new \DateTime(), 'to' => new \DateTime()], falsetruefalsenull$this->security->getUser(), false );
  134.                 $todayConsumersbyOs  $this->doctrine->getManager()->getRepository(Detections::class)->findDetections(nullfalsefalsefalsenullnull, ['from'=> new \DateTime(), 'to' => new \DateTime()], truetruefalsenull$this->security->getUser(), false);
  135.                 $toDayDoughnutConsumersChart $this->charts->generateDoughnutChart($todayConsumersbyOs"nbrConsumers""nbrOsDetections"DataType::Consumers"os");
  136.                 $todayConsumersbyDeviceType  $this->doctrine->getManager()->getRepository(Detections::class)->findDetections(nullfalsefalsenullnullnull, ['from'=> new \DateTime(), 'to' => new \DateTime()], falsetruetruenull$this->security->getUser(), false);
  137.                 $toDayBarConsumersChart $this->charts->generateBarChart($todayConsumersbyDeviceType"nbrConsumers""nbrDeviceDetections"DataType::Consumers"deviceType");
  138.                 $consumersByCountryDT $this->charts->generateDTDetectionsByCountry($todayConsumersbyCountryDataType::Consumers$countries);
  139.                 $consumersbyRegionDT $this->charts->generateDTDetectionsByRegion($todayConsumersbyRegionDataType::Consumers$countries);
  140.                 $consumersTopMediasTable $this->charts->generateDTDetectionsByMedia($todayTopMediasConsumersDataType::Consumers);
  141.                 $consumersTopSpotsTable $this->charts->generateDTDetectionsBySpot($todayTopSpotsConsumersDataType::Consumers);
  142.                     
  143.                 return new JsonResponse([
  144.                 'countries' => array_flip($countries),
  145.                 //'todayConsumers'=> $todayConsumers,
  146.                 'consumersTopMediasTable'=>$consumersTopMediasTable,
  147.                 'consumersByMediasTable'=>$consumersTopMediasTable,
  148.                 'consumersBySpotsTable' => $consumersTopSpotsTable,
  149.                 'consumersTopSpotsTable' => $consumersTopSpotsTable,
  150.                 'consumersByCountry'=>$todayConsumersbyCountry,
  151.                 'consumersTopCountry'=>$todayConsumersbyCountry,
  152.                 'worldMapConsumers'=>$toDayWorldMapConsumers,
  153.                 'consumersbyRegion'=>$todayConsumersbyRegion,
  154.                 'doughnutConsumersChart'=>$toDayDoughnutConsumersChart,
  155.                 'barConsumersChart'=>$toDayBarConsumersChart,
  156.                 'consumersbyCountryTable'=>$consumersByCountryDT,
  157.                 'consumersbyRegionTable' => $consumersbyRegionDT,
  158.                 ]);
  159.             case "yesterday":
  160.                 //yesterday               
  161.                 $yesterdayTopMediasConsumers $this->doctrine->getManager()->getRepository(Detections::class)->getTopMediasAndSpots(falsetrue $this->security->getUser(), truenull, ['from'=> $yesterday'to' => $yesterday]);
  162.                 $yesterdayTopSpotsConsumers $this->doctrine->getManager()->getRepository(Detections::class)->getTopMediasAndSpots(truefalse $this->security->getUser(), truenull, ['from'=> $yesterday'to' => $yesterday]);
  163.                 $yesterdayConsumersbyCountry  $this->doctrine->getManager()->getRepository(Detections::class)->findDetections(falsefalsetruenullnullnull, ['from'=> $yesterday'to' => $yesterday], falsetruefalsenull$this->security->getUser(), false);
  164.                 $yesterdayWorldMapConsumers $this->charts->updateMapAreas($yesterdayConsumersbyCountryarray_flip($countries), DataType::Consumers);
  165.                 $yesterdayConsumersbyRegion  $this->doctrine->getManager()->getRepository(Detections::class)->findDetections(falsefalsetruetruenullnull, ['from'=> $yesterday'to' => $yesterday], falsetruefalsenull$this->security->getUser(), false );
  166.                 $yesterdayConsumersbyOs  $this->doctrine->getManager()->getRepository(Detections::class)->findDetections(nullfalsefalsefalsenullnull, ['from'=> $yesterday'to' => $yesterday], truetruefalsenull$this->security->getUser(), false);
  167.                 $yesterdayDoughnutConsumersChart $this->charts->generateDoughnutChart($yesterdayConsumersbyOs"nbrConsumers""nbrOsDetections"DataType::Consumers"os");
  168.                 $yesterdayConsumersbyDeviceType  $this->doctrine->getManager()->getRepository(Detections::class)->findDetections(nullfalsefalsenullnullnull, ['from'=> $yesterday'to' => $yesterday], falsetruetruenull$this->security->getUser(), false);
  169.                 $yesterdayBarConsumersChart $this->charts->generateBarChart($yesterdayConsumersbyDeviceType"nbrConsumers""nbrDeviceDetections"DataType::Consumers"deviceType");
  170.                 $consumersByCountryDT $this->charts->generateDTDetectionsByCountry($yesterdayConsumersbyCountryDataType::Consumers$countries);
  171.                 $consumersbyRegionDT $this->charts->generateDTDetectionsByRegion($yesterdayConsumersbyRegionDataType::Consumers$countries);
  172.                 $consumersTopMediasTable $this->charts->generateDTDetectionsByMedia($yesterdayTopMediasConsumersDataType::Consumers);
  173.                 $consumersTopSpotsTable $this->charts->generateDTDetectionsBySpot($yesterdayTopSpotsConsumersDataType::Consumers);
  174.                     
  175.                 return new JsonResponse([
  176.                 'countries' => array_flip($countries),
  177.                 //'todayConsumers'=> $todayConsumers,
  178.                 'consumersTopMediasTable'=>$consumersTopMediasTable,
  179.                 'consumersByMediasTable'=>$consumersTopMediasTable,
  180.                 'consumersBySpotsTable' => $consumersTopSpotsTable,
  181.                 'consumersTopSpotsTable' => $consumersTopSpotsTable,
  182.                 'consumersByCountry'=>$yesterdayConsumersbyCountry,
  183.                 'consumersTopCountry'=>$yesterdayConsumersbyCountry,
  184.                 'worldMapConsumers'=>$yesterdayWorldMapConsumers,
  185.                 'consumersbyRegion'=>$yesterdayConsumersbyRegion,
  186.                 'doughnutConsumersChart'=>$yesterdayDoughnutConsumersChart,
  187.                 'barConsumersChart'=>$yesterdayBarConsumersChart,
  188.                 'consumersbyCountryTable'=>$consumersByCountryDT,
  189.                 'consumersbyRegionTable' => $consumersbyRegionDT,
  190.                 ]);
  191.                 case "tomonth":
  192.                     //toMonth
  193.                     $tomonthTopMediasConsumers $this->doctrine->getManager()->getRepository(Detections::class)->getTopMediasAndSpots(falsetrue $this->security->getUser(), true, (new \DateTime())->format('m'));
  194.                     $tomonthTopSpotsConsumers $this->doctrine->getManager()->getRepository(Detections::class)->getTopMediasAndSpots(truefalse $this->security->getUser(), true, (new \DateTime())->format('m'));
  195.                     $tomonthConsumersbyCountry  $this->doctrine->getManager()->getRepository(Detections::class)->findDetections(falsefalsetruenullnull, (new \DateTime())->format('m'), nullfalsetruefalsenull$this->security->getUser(), false);
  196.                     $tomonthWorldMapConsumers $this->charts->updateMapAreas($tomonthConsumersbyCountryarray_flip($countries), DataType::Consumers);
  197.                     $tomonthConsumersbyRegion  $this->doctrine->getManager()->getRepository(Detections::class)->findDetections(falsefalsetruetruenull,(new \DateTime())->format('m'), nullfalsetruefalsenull$this->security->getUser(), false );
  198.                     $tomonthConsumersbyOs  $this->doctrine->getManager()->getRepository(Detections::class)->findDetections(nullfalsefalsefalsenull, (new \DateTime())->format('m'), nulltruetruefalsenull$this->security->getUser(), false);
  199.                     $tomonthDoughnutConsumersChart $this->charts->generateDoughnutChart($tomonthConsumersbyOs"nbrConsumers""nbrOsDetections"DataType::Consumers"os");
  200.                     $tomonthConsumersbyDeviceType  $this->doctrine->getManager()->getRepository(Detections::class)->findDetections(nullfalsefalsenullnull, (new \DateTime())->format('m'), nullfalsetruetruenull$this->security->getUser(), false);
  201.                     $tomonthBarConsumersChart $this->charts->generateBarChart($tomonthConsumersbyDeviceType"nbrConsumers""nbrDeviceDetections"DataType::Consumers"deviceType");
  202.                     $consumersByCountryDT $this->charts->generateDTDetectionsByCountry($tomonthConsumersbyCountryDataType::Consumers$countries);
  203.                     $consumersbyRegionDT $this->charts->generateDTDetectionsByRegion($tomonthConsumersbyRegionDataType::Consumers$countries);
  204.                     $consumersTopMediasTable $this->charts->generateDTDetectionsByMedia($tomonthTopMediasConsumersDataType::Consumers);
  205.                     $consumersTopSpotsTable $this->charts->generateDTDetectionsBySpot($tomonthTopSpotsConsumersDataType::Consumers);
  206.                     
  207.                     return new JsonResponse([
  208.                     'countries' => array_flip($countries),
  209.                     //'todayConsumers'=> $todayConsumers,
  210.                     'consumersTopMediasTable'=>$consumersTopMediasTable,
  211.                     'consumersByMediasTable'=>$consumersTopMediasTable,
  212.                     'consumersBySpotsTable' => $consumersTopSpotsTable,
  213.                     'consumersTopSpotsTable' => $consumersTopSpotsTable,
  214.                     'consumersByCountry'=>$tomonthConsumersbyCountry,
  215.                     'consumersTopCountry'=>$tomonthConsumersbyCountry,
  216.                     'worldMapConsumers'=>$tomonthWorldMapConsumers,
  217.                     'consumersbyRegion'=>$tomonthConsumersbyRegion,
  218.                     'doughnutConsumersChart'=>$tomonthDoughnutConsumersChart,
  219.                     'barConsumersChart'=>$tomonthBarConsumersChart,
  220.                     'consumersbyCountryTable'=>$consumersByCountryDT,
  221.                     'consumersbyRegionTable' => $consumersbyRegionDT,
  222.     
  223.                         
  224.                     ]);
  225.                     case "yestermonth":
  226.                         //yesterMonth
  227.                         $yestermonthTopMediasConsumers $this->doctrine->getManager()->getRepository(Detections::class)->getTopMediasAndSpots(falsetrue $this->security->getUser(), true$yestermonth);
  228.                         $yestermonthTopSpotsConsumers $this->doctrine->getManager()->getRepository(Detections::class)->getTopMediasAndSpots(truefalse $this->security->getUser(), true$yestermonth);
  229.                         $yestermonthConsumersbyCountry  $this->doctrine->getManager()->getRepository(Detections::class)->findDetections(falsefalsetruenullnull$yestermonthnullfalsetruefalsenull$this->security->getUser(), false);
  230.                         $yestermonthWorldMapConsumers $this->charts->updateMapAreas($yestermonthConsumersbyCountry,array_flip$countries), DataType::Consumers);
  231.                         $yestermonthConsumersbyRegion  $this->doctrine->getManager()->getRepository(Detections::class)->findDetections(falsefalsetruetruenull,$yestermonthnullfalsetruefalsenull$this->security->getUser(), false );
  232.                         $yestermonthConsumersbyOs  $this->doctrine->getManager()->getRepository(Detections::class)->findDetections(nullfalsefalsefalsenull$yestermonthnulltruetruefalsenull$this->security->getUser(), false);
  233.                         $yestermonthDoughnutConsumersChart $this->charts->generateDoughnutChart($yestermonthConsumersbyOs"nbrConsumers""nbrOsDetections"DataType::Consumers"os");
  234.                         $yestermonthConsumersbyDeviceType  $this->doctrine->getManager()->getRepository(Detections::class)->findDetections(nullfalsefalsenullnull$yestermonthnullfalsetruetruenull$this->security->getUser(), false);
  235.                         $yestermonthBarConsumersChart $this->charts->generateBarChart($yestermonthConsumersbyDeviceType"nbrConsumers""nbrDeviceDetections"DataType::Consumers"deviceType");
  236.                         $consumersByCountryDT $this->charts->generateDTDetectionsByCountry($yestermonthConsumersbyCountryDataType::Consumers$countries);
  237.                         $consumersbyRegionDT $this->charts->generateDTDetectionsByRegion($yestermonthConsumersbyRegionDataType::Consumers$countries);
  238.                         $consumersTopMediasTable $this->charts->generateDTDetectionsByMedia($yestermonthTopMediasConsumersDataType::Consumers);
  239.                         $consumersTopSpotsTable $this->charts->generateDTDetectionsBySpot($yestermonthTopSpotsConsumersDataType::Consumers);
  240.                        
  241.                         return new JsonResponse([
  242.                             'countries' => array_flip($countries),
  243.                             //'todayConsumers'=> $todayConsumers,
  244.                             'consumersTopMediasTable'=>$consumersTopMediasTable,
  245.                             'consumersByMediasTable'=>$consumersTopMediasTable,
  246.                             'consumersBySpotsTable' => $consumersTopSpotsTable,
  247.                             'consumersTopSpotsTable' => $consumersTopSpotsTable,
  248.                             'consumersByCountry'=>$yestermonthConsumersbyCountry,
  249.                             'consumersTopCountry'=>$yestermonthConsumersbyCountry,
  250.                             'worldMapConsumers'=>$yestermonthWorldMapConsumers,
  251.                             'consumersbyRegion'=>$yestermonthConsumersbyRegion,
  252.                             'doughnutConsumersChart'=>$yestermonthDoughnutConsumersChart,
  253.                             'barConsumersChart'=>$yestermonthBarConsumersChart,
  254.                             'consumersbyCountryTable'=>$consumersByCountryDT,
  255.                             'consumersbyRegionTable' => $consumersbyRegionDT,
  256.                         ]);
  257.                        
  258.         }
  259.     }
  260. }