Welcome Guest, Not a member yet? Register   Sign In
Inaccuracy? Edit Entity attributes
#6

The setAttributes() method is needed in order to set the data as it is. That is, so that mutations are not applied.

If you want a fullname attribute that is essentially a derivative of firstName and lastName , you can add a getter.
PHP Code:
public function getFullName(): string
{
    return 
$this->firstName ' ' $this->lastName;
}

$user->fullName // return fullname 
Reply


Messages In This Thread
Inaccuracy? Edit Entity attributes - by ozornick - 07-29-2022, 12:44 PM
RE: Inaccuracy? Edit Entity attributes - by iRedds - 07-31-2022, 02:52 AM



Theme © iAndrew 2016 - Forum software by © MyBB