You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
496 B
19 lines
496 B
<?php
|
|
|
|
namespace App\GraphQL\Queries;
|
|
use App\Models\CovidData;
|
|
use Carbon\Carbon;
|
|
|
|
class SearchData
|
|
{
|
|
/**
|
|
* @param null $_
|
|
* @param array<string, mixed> $args
|
|
*/
|
|
public function __invoke($_, array $args)
|
|
{
|
|
$endDate = isset($args["endDate"]) ? $args["endDate"]->endOfDay() : Carbon::now();
|
|
$data = CovidData::where('created_at','>=',$args["beginDate"])->where('created_at','<=',$endDate)->orderBy('created_at')->get();
|
|
return $data;
|
|
}
|
|
}
|
|
|