How can I use $this in object key's value?
$data = (object) [
'name' => 'john',
'other' => $this->name.' , wellcome',
];
what can I use for $this ?
Create a synthetic local variable, then reuse it:
$data = (object) [
'name' => ($name = 'john'),
'other' => $name.' , wellcome',
];
Use at your own risk.