Kieran_st's avatar

Eloquent and Trimming relation fields

So, I have a field which is populated by a program with an ID for a user, however it puts in extra "s.

eg. "13456" is the string returned. No I can't prevent it from adding this, it's not something I have the ability to make large modifications on, I just need to work around it...

So I'm trying to make a relationship from this table to my user table, but because of the extra "s, I can't make a direct relationship, as the string id of "1234" doesn't exist, but string id of 1234 does...

Is there some way I can run the column through a trim function to cut off the " before putting it into the belongs-to query?

Crossposted to: http://stackoverflow.com/questions/42449877/laravel-eloquent-and-trimming-fields-for-use-in-relationships

0 likes
0 replies

Please or to participate in this conversation.