I cart date setters
This commit is contained in:
parent
3d7a273946
commit
7da5eb9f72
|
|
@ -193,13 +193,16 @@ class Cart extends Model
|
|||
* @throws InvalidDateRangeException
|
||||
* @throws NotEnoughAvailableInTimespanException
|
||||
*/
|
||||
public function setDates(\DateTimeInterface|string $from, \DateTimeInterface|string $until, bool $validateAvailability = true): self
|
||||
{
|
||||
public function setDates(
|
||||
\DateTimeInterface|string|int|float $from,
|
||||
\DateTimeInterface|string|int|float $until,
|
||||
bool $validateAvailability = true
|
||||
): self {
|
||||
// Parse string dates using Carbon
|
||||
if (is_string($from)) {
|
||||
if (is_string($from) || is_numeric($from)) {
|
||||
$from = Carbon::parse($from);
|
||||
}
|
||||
if (is_string($until)) {
|
||||
if (is_string($until) || is_numeric($until)) {
|
||||
$until = Carbon::parse($until);
|
||||
}
|
||||
|
||||
|
|
@ -228,10 +231,12 @@ class Cart extends Model
|
|||
* @throws InvalidDateRangeException
|
||||
* @throws NotEnoughAvailableInTimespanException
|
||||
*/
|
||||
public function setFromDate(\DateTimeInterface|string $from, bool $validateAvailability = true): self
|
||||
{
|
||||
public function setFromDate(
|
||||
\DateTimeInterface|string|int|float $from,
|
||||
bool $validateAvailability = true
|
||||
): self {
|
||||
// Parse string dates using Carbon
|
||||
if (is_string($from)) {
|
||||
if (is_string($from) || is_numeric($from)) {
|
||||
$from = Carbon::parse($from);
|
||||
}
|
||||
|
||||
|
|
@ -257,10 +262,10 @@ class Cart extends Model
|
|||
* @throws InvalidDateRangeException
|
||||
* @throws NotEnoughAvailableInTimespanException
|
||||
*/
|
||||
public function setUntilDate(\DateTimeInterface|string $until, bool $validateAvailability = true): self
|
||||
public function setUntilDate(\DateTimeInterface|string|int|float $until, bool $validateAvailability = true): self
|
||||
{
|
||||
// Parse string dates using Carbon
|
||||
if (is_string($until)) {
|
||||
if (is_string($until) || is_numeric($until)) {
|
||||
$until = Carbon::parse($until);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -432,10 +432,10 @@ class CartItem extends Model
|
|||
* @return $this
|
||||
* @throws InvalidDateRangeException
|
||||
*/
|
||||
public function setFromDate(\DateTimeInterface|string $from): self
|
||||
public function setFromDate(\DateTimeInterface|string|int|float $from): self
|
||||
{
|
||||
// Parse string dates using Carbon
|
||||
if (is_string($from)) {
|
||||
if (is_string($from) || is_numeric($from)) {
|
||||
$from = \Carbon\Carbon::parse($from);
|
||||
}
|
||||
|
||||
|
|
@ -464,10 +464,10 @@ class CartItem extends Model
|
|||
* @return $this
|
||||
* @throws InvalidDateRangeException
|
||||
*/
|
||||
public function setUntilDate(\DateTimeInterface|string $until): self
|
||||
public function setUntilDate(\DateTimeInterface|string|int|float $until): self
|
||||
{
|
||||
// Parse string dates using Carbon
|
||||
if (is_string($until)) {
|
||||
if (is_string($until) || is_numeric($until)) {
|
||||
$until = \Carbon\Carbon::parse($until);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue