-
-
Notifications
You must be signed in to change notification settings - Fork 66
Expand file tree
/
Copy pathDateTimeAdapterInterface.php
More file actions
35 lines (30 loc) · 861 Bytes
/
DateTimeAdapterInterface.php
File metadata and controls
35 lines (30 loc) · 861 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
declare(strict_types=1);
namespace Workflow\Domain\Contracts;
/**
* Interface for handling database-specific datetime operations.
*
* Different databases handle microseconds differently (e.g., MongoDB needs string conversion,
* SQL can use native datetime with microseconds).
*/
interface DateTimeAdapterInterface
{
/**
* Get the casts array for a model.
*/
public function getCasts(array $baseCasts): array;
/**
* Format a datetime value for storage.
*
* @param mixed $value
* @return mixed
*/
public function formatForStorage($value, string $format = 'Y-m-d H:i:s.u');
/**
* Parse a datetime value from storage.
*
* @param mixed $value
* @return \Illuminate\Support\Carbon|null
*/
public function parseFromStorage($value, string $format = 'Y-m-d H:i:s.u');
}