dde-matt
1 month ago
121
5
Laravel

PHP Class Visibility

Posted 1 month ago by dde-matt

If I create a new instance of my Address Eloquent model, at first obviously no model attributes shows in tinker

$address = new Address;

App\Models\Address {#1065}

But then if I add a value to the reference attribute, the reference attribute will show in tinker

$shape->reference = 123;

App\Models\Address {#1074
    reference: 123,
}

But this property actually lives in the protected $attributes array inside the Eloquent model. So, how does it appear here in tinker?

Please sign in or create an account to participate in this conversation.