Skip to content

Commit

Permalink
Update eloquent-mutators.md (#7953)
Browse files Browse the repository at this point in the history
  • Loading branch information
RahulDey12 authored May 25, 2022
1 parent 0b6c16d commit 7fbbf87
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions eloquent-mutators.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ use Illuminate\Database\Eloquent\Casts\Attribute;
*
* @return \Illuminate\Database\Eloquent\Casts\Attribute
*/
public function address(): Attribute
protected function address(): Attribute
{
return Attribute::make(
get: fn ($value, $attributes) => new Address(
Expand Down Expand Up @@ -108,7 +108,7 @@ When returning value objects from accessors, any changes made to the value objec
However, you may sometimes wish to enable caching for primitive values like strings and booleans, particularly if they are computationally intensive. To accomplish this, you may invoke the `shouldCache` method when defining your accessor:

```php
public function hash(): Attribute
protected function hash(): Attribute
{
return Attribute::make(
get: fn ($value) => bcrypt(gzuncompress($value)),
Expand All @@ -124,7 +124,7 @@ If you would like to disable the object caching behavior of attributes, you may
*
* @return \Illuminate\Database\Eloquent\Casts\Attribute
*/
public function address(): Attribute
protected function address(): Attribute
{
return Attribute::make(
get: fn ($value, $attributes) => new Address(
Expand Down Expand Up @@ -188,7 +188,7 @@ use Illuminate\Database\Eloquent\Casts\Attribute;
*
* @return \Illuminate\Database\Eloquent\Casts\Attribute
*/
public function address(): Attribute
protected function address(): Attribute
{
return Attribute::make(
get: fn ($value, $attributes) => new Address(
Expand Down

0 comments on commit 7fbbf87

Please sign in to comment.