the primary concerns of the domain experts and their most relevant knowledge while it sloughs of the superficial aspects of the domain.” - Domain-Driven Design
{ abstract public function render(); } class ConcreteViewModel extends ViewModel { public function render() { return […] } } $vm = new ConcreteViewModel([‘foo’ => $foo]); $vm->foo // attribute
render() { $additionals = [‘full_name’]; return $this->user->append($additionals); } } class User extends Model { public function getFullNameAttribute() { return $this->family_name . ’ ’ . $this->given_name; } } // like DTO return (new UserView([‘user’ => $user]))->render();