*/ protected $fillable = [ 'name', 'email', 'password', ]; /** * The attributes that should be hidden for serialization. * * @var array */ protected $hidden = [ 'password', 'remember_token', ]; /** * The attributes that should be cast. * * @var array */ protected $casts = [ 'email_verified_at' => 'datetime', ]; /** * The attributes that appends to returned entities. * * @var array */ protected $appends = ['photo']; /** * The getter that return accessible URL for user photo. * * @var array */ public function getPhotoUrlAttribute(): string { if ($this->foto !== null) { return url('media/user/' . $this->id . '/' . $this->foto); } else { return url('media-example/no-image.png'); } } }