<?php class User { protected $appends = ['avatar_url']; public function getAvatarUrlAttribute() { return 'https://i.pravatar.cc/300?u=' . $this->email; } }