Support the ongoing development of →
Database Eloquent
Last updated 7 months ago.

A getter acts on the value that has been pulled from the database only when the field is requested. This means that the value has already been retrieved by the time the getter fires.

Last updated 7 months ago.

Thanks for answering... Any suggestion of doing this with Eloquent or do you recommend go to Repository Pattern and define All()/ find() /etc...? I really want to stay on Eloquent.

Last updated 7 months ago.

I find a solution that works for my situation and I share it here.

public function newQuery($excludeDeleted = true)
    return parent::newQuery()->addSelect('*',DB::raw('asText(position) wkt'));

// I added $append = ['wkt']; & hidden= ['position']

If you think it could be better let me know

Last updated 7 months ago.

Sign in to participate in this thread!

Full Stack Europe

Your banner here too?


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2022 - All rights reserved.