Welcome Guest, Not a member yet? Register   Sign In
Joining two models with same column names

On CI 4 , when we have 2 Models that are joined betweene but they have same names how can we join them using CI model's

Let's suppose we have

Account [ account_id, name, city_id, updated_at....]
City [ city_id, name, updated_at....]

Here the 2 models have fields name , updated_at ...
When we want to retrieve data how can we do this to avoid conflicts, because when I'm doing it overriding values.

Thank you

You should be able to specify aliases in a select() method:
$model->select('cities.name AS city_name')...

Theme © iAndrew 2016 - Forum software by © MyBB