简体   繁体   中英

How to handle database partitioning in laravel with model

I have table partitioned into say P14, P17, p16 etc. and I am using eloquent model I want to select the data from this partition.

For this use case I am not getting I should I use partitioning with model and I don't want to use raw query solution.

Is there any way where I can specify the partition in:

$result=ModelName::where(codition)->get();

Eloquent model mapping to partition table, for example, table_001, table_002...

 $user = new User();
 user->setConnection('table_001');
 $user->name = 'Joe';
 $user->save();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM