/**
  * Get statistic data.
  *
  * @return Response
  */
 public function monthStatistic($month, $year, Request $request)
 {
     $statistics = new \stdClass();
     $StatisticEndDate = Carbon::create($year, $month, 1, 0, 0, 0)->addMonth(1);
     $StatisticStartDate = Carbon::create($year, $month, 1, 0, 0, 0);
     $statistics->companies = [Companies::whereNull("Deleted")->where("Date_Created", "<", $StatisticEndDate)->where("Date_Created", ">", $StatisticStartDate)->get()->count(), Companies::whereNull("Deleted")->get()->count()];
     $statistics->products = [Products::whereNull("Deleted")->where("Date_Created", "<", $StatisticEndDate)->where("Date_Created", ">", $StatisticStartDate)->get()->count(), Products::whereNull("Deleted")->get()->count()];
     $statistics->news = [News::whereNull("Deleted")->where("Date_Created", "<", $StatisticEndDate)->where("Date_Created", ">", $StatisticStartDate)->get()->count(), News::whereNull("Deleted")->get()->count()];
     $statistics->people = [People::whereNull("Deleted")->where("Date_Created", "<", $StatisticEndDate)->where("Date_Created", ">", $StatisticStartDate)->get()->count(), People::whereNull("Deleted")->get()->count()];
     return json_encode($statistics);
 }
Exemplo n.º 2
0
 public function getTagsList($category)
 {
     switch ($category) {
         case 'Companies':
             return Companies::whereNull("Deleted")->orderBy('Company_Full_Name', 'asc')->get(['id_Company as id', 'Company_Full_Name as description'])->toJson();
         case 'People':
             return People::whereNull("Deleted")->orderBy('First_Name', 'asc')->get(['id_People as id', 'First_Name as description'])->toJson();
         case 'Vertical':
             return Vertical::all(['id_Vertical as id', 'Main_Description as description'])->toJson();
         case 'Products':
             return Products::whereNull("Deleted")->orderBy('Product_Title', 'asc')->get(['id_Product as id', 'Product_Title as description'])->toArray();
         case 'Events':
             return Event::all(['id_Event as id', 'Event_Title as description'])->toJson();
     }
 }