[input_key1, input_key2]]. * * @var array */ public $relations = []; public function user($id) { return $this->where("created_by", $id); } public function time($time) { return match ($time) { "today" => $this->where("created_at", ">=", Carbon::now()->startOfDay()), "yesterday" => $this->where("created_at", ">=", Carbon::now()->subDay()->startOfDay()) ->where("created_at", "<", Carbon::now()->startOfDay()), "this_week" => $this->where("created_at", ">=", Carbon::now()->startOfWeek()), "last_week" => $this->where("created_at", ">=", Carbon::now()->subWeek()->startOfWeek()) ->where("created_at", "<", Carbon::now()->startOfWeek()), "this_month" => $this->where("created_at", ">=", Carbon::now()->startOfMonth()), "last_month" => $this->where("created_at", ">=", Carbon::now()->subMonth()->startOfMonth()) ->where("created_at", "<", Carbon::now()->startOfMonth()), default => $this, }; } }