hmmm actually i don't know how to explain about accessor, so if i'm wrong, correct me
Accessor is not a real column, in normal case it Only represent in response
just make a simple test: put this code in any model
protected $appends = ['hello_kitty'];
public function getHelloKittyAttribute()
{
return 'Hello guys.';
}
Case 1: 'hello_kitty' is not represent
dd($post);
Case 2: 'hello_kitty' is represent
return $post;
Case 3: dynamic append
// protected $appends = ['hello_kitty'];
$post->append(['hello_kitty'])->toArray();
dd($post); // 'hello_kitty' is not represent
return $post; // 'hello_kitty' is represent
Case 4: dynamic append, asign to a variable
// protected $appends = ['hello_kitty'];
$post = $post->append(['hello_kitty'])->toArray();
dd($post); // 'hello_kitty' is represent
return $post; // 'hello_kitty' is represent