My current model:
- A record belongsTo a city
- A city belongsTo a country
Currently I’m storing how many records each city has with this simple config on RecordsTable.php:
‘Cities’ => [‘cantidad_registros’],
Now, I want to also keep in the field Countries->records how many records does that country has.
I can’t find the solution on the book, I’ve also tried (without success) using a BelongsToMany even though I know this is not the case. I’m starting to think this is not possible to do using the CounterCache and I need to write my own code.
Thanks in advance!