File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed
Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change 2121 "require" : {
2222 "ext-curl" : " *" ,
2323 "ext-json" : " *" ,
24- "symfony/polyfill-php80 " : " ^1 .0" ,
24+ "nesbot/carbon " : " ^2 .0" ,
2525 "psr/http-client-implementation" : " ^1.0" ,
2626 "php-http/client-common" : " ^2.5" ,
27- "php-http/discovery" : " ^1.14"
27+ "php-http/discovery" : " ^1.14" ,
28+ "symfony/polyfill-php80" : " ^1.0"
2829 },
2930 "require-dev" : {
3031 "friendsofphp/php-cs-fixer" : " ^3.9" ,
Original file line number Diff line number Diff line change 44
55namespace Hypernode \Api \Resource ;
66
7+ use Carbon \Carbon ;
8+
79class AbstractResource
810{
911 protected array $ data ;
12+ protected array $ dateAttributes = [];
1013
1114 public function __get (string $ name )
1215 {
13- return $ this ->data [$ name ] ?? null ;
16+ $ value = $ this ->data [$ name ] ?? null ;
17+
18+ if (in_array ($ name , $ this ->dateAttributes )) {
19+ return Carbon::create ($ value );
20+ }
21+
22+ return $ value ;
1423 }
1524
1625 public function __isset ($ name )
You can’t perform that action at this time.
0 commit comments