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
Post a Comment