Skip to content
This repository was archived by the owner on Mar 12, 2024. It is now read-only.

Commit 9a78458

Browse files
Update README.md
1 parent 51b3c67 commit 9a78458

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ class CompanyProfile extends Component
4545
*
4646
* @var string|null
4747
*/
48-
public ?string $name;
49-
public ?string $tax_number;
50-
public ?string $address;
48+
public ?string $name = null;
49+
public ?string $tax_number = null;
50+
public ?string $address = null;
5151

5252
/**
5353
* @return void
@@ -59,6 +59,10 @@ class CompanyProfile extends Component
5959
}
6060
```
6161

62+
## Why?
63+
Why should I use it like this instead of just passing the model to the view?
64+
Because the models are huge objects and you probably shouldn't expose them to the frontend for security and performance reasons. Another thing is primitive view variables are highly customizable through view composers, while it's harder to decorate in the case of using models.
65+
6266
## Testing
6367
```bash
6468
composer test

0 commit comments

Comments
 (0)