@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | protected $data; |
| 46 | 46 | |
| 47 | 47 | /** @var array $relational_fields no update or create */ |
| 48 | - protected $relational_fields = []; |
|
| 48 | + protected $relational_fields = [ ]; |
|
| 49 | 49 | |
| 50 | 50 | /** |
| 51 | 51 | * DataLayer constructor. |
@@ -254,9 +254,9 @@ discard block |
||
| 254 | 254 | */ |
| 255 | 255 | protected function required(): bool |
| 256 | 256 | { |
| 257 | - $data = (array)$this->data(); |
|
| 257 | + $data = (array) $this->data(); |
|
| 258 | 258 | foreach ($this->required as $field) { |
| 259 | - if (empty($data[$field])) { |
|
| 259 | + if (empty($data[ $field ])) { |
|
| 260 | 260 | return false; |
| 261 | 261 | } |
| 262 | 262 | } |
@@ -268,9 +268,9 @@ discard block |
||
| 268 | 268 | */ |
| 269 | 269 | protected function safe(): ?array |
| 270 | 270 | { |
| 271 | - $safe = (array)$this->data; |
|
| 272 | - foreach (array_merge([$this->primary, "updated_at", "created_at"], $this->relational_fields) as $unset) { |
|
| 273 | - unset($safe[$unset]); |
|
| 271 | + $safe = (array) $this->data; |
|
| 272 | + foreach (array_merge([ $this->primary, "updated_at", "created_at" ], $this->relational_fields) as $unset) { |
|
| 273 | + unset($safe[ $unset ]); |
|
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | return $safe; |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | public function __construct() |
| 17 | 17 | { |
| 18 | - parent::__construct("socials", ["social", "link"]); |
|
| 18 | + parent::__construct("socials", [ "social", "link" ]); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | /** |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | public function __construct() |
| 17 | 17 | { |
| 18 | - parent::__construct("address", [], 'address_id'); |
|
| 18 | + parent::__construct("address", [ ], 'address_id'); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | /** |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | */ |
| 16 | 16 | public function __construct() |
| 17 | 17 | { |
| 18 | - parent::__construct("users", ["first_name", "last_name"]); |
|
| 18 | + parent::__construct("users", [ "first_name", "last_name" ]); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | /** |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | */ |
| 25 | 25 | public function address(bool $obj = false): User |
| 26 | 26 | { |
| 27 | - $this->relational_fields[] = 'address'; |
|
| 27 | + $this->relational_fields[ ] = 'address'; |
|
| 28 | 28 | |
| 29 | 29 | if ($obj) { |
| 30 | 30 | $this->address = (new Address())->findByUser($this->id); |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | */ |
| 47 | 47 | public function socials(bool $obj = false): User |
| 48 | 48 | { |
| 49 | - $this->relational_fields[] = 'socials'; |
|
| 49 | + $this->relational_fields[ ] = 'socials'; |
|
| 50 | 50 | $socials = (new Socials())->getUserSocials($this->id); |
| 51 | 51 | |
| 52 | 52 | if ($obj) { |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | foreach ($socials as $key => $value) { |
| 63 | - $user_socials[] = $value->data(); |
|
| 63 | + $user_socials[ ] = $value->data(); |
|
| 64 | 64 | } |
| 65 | 65 | $this->socials = $user_socials; |
| 66 | 66 | return $this; |