Support the ongoing development of Laravel.io →
Database Eloquent
Last updated 1 year ago.
0

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 1 year ago.
0

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 1 year ago.
0

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 1 year ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

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

Your logo here?

Laravel.io

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

© 2024 Laravel.io - All rights reserved.