We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fbf9d3f commit 5f2c8caCopy full SHA for 5f2c8ca
1 file changed
app/Http/Resources/PolicyResource.php
@@ -15,11 +15,17 @@ class PolicyResource extends JsonResource {
15
public static $wrap = null;
16
17
public function toArray(Request $request): array {
18
+ $activeFrom = $this->active_from;
19
+
20
+ if ($this->active_from !== null) {
21
+ $activeFrom = Carbon::parse($this->active_from)->format('Y-m-d');
22
+ }
23
24
return [
25
'metadata' => [
26
'policy_id' => $this->id,
27
'type' => $this->policy_type,
- 'active_from' => Carbon::parse($this->active_from)->format('Y-m-d'),
28
+ 'active_from' => $activeFrom,
29
'content_vue_file' => $this->content_vue_file,
30
],
31
];
0 commit comments