Skip to content

Commit a696f5a

Browse files
committed
update mutator docs.
1 parent b8e358b commit a696f5a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

eloquent.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -530,13 +530,13 @@ Sometimes, you may wish to return a custom Collection object with your own added
530530
<a name="accessors-and-mutators"></a>
531531
## Accessors & Mutators
532532

533-
Eloquent provides a convenient way to transform your model attributes when getting or setting them. Simplify define a `giveFoo` method on your model to declare an accessor. Keep in mind that the methods should follow camel-casing, even though your database columns are snake-case:
533+
Eloquent provides a convenient way to transform your model attributes when getting or setting them. Simplify define a `getFooAttribute` method on your model to declare an accessor. Keep in mind that the methods should follow camel-casing, even though your database columns are snake-case:
534534

535535
**Defining An Accessor**
536536

537537
class User extends Eloquent {
538538

539-
public function giveFirstName($value)
539+
public function getFirstNameAttribute($value)
540540
{
541541
return ucfirst($value);
542542
}
@@ -551,7 +551,7 @@ Mutators are declared in a similar fashion:
551551

552552
class User extends Eloquent {
553553

554-
public function takeFirstName($value)
554+
public function setFirstNameAttribute($value)
555555
{
556556
$this->attributes['first_name'] = strtolower($value);
557557
}

0 commit comments

Comments
 (0)