php - Use multiple Database Tables in single model in Lumen Framework -


i have these database tables:

country_us country_fr country_en country_nl country_es 

how can create single model above tables? database structure of these tables same.

what can workaround scenario in lumen framework?

i don't know reason having such bad database design. ideal have 1 table 'language' column.

anyway, 1 dirty way overwrite gettable() method:

/**  * table associated model.  *  * @return string  */ public function gettable() {     if ($conditionus)         return 'country_us';       if ($conditionfr)         return 'country_fr';      // etc ...  } 

the gettable() method method laravel intenally uses determine table should use model. if override it, take control of table used.


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -