PHP Laravel: Update one -to- many relationship -


i have 1 many relationship in eloquent model , know best approach go updating model, belongsto model part.

i have come across other answers suggest save each belongsto model singly, brings problem making n amount of calls database server instead of single insert or few.

so know best approach ensure query , database resourse optimized , efficient.

hasone / hasmany (1-1, 1-m) 1. save(new or existing) 2. savemany(array of models new or existing)

use of these 2 methods..


Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

Cross-Compiling Linux Kernel for Raspberry Pi - ${CCPREFIX}gcc -v does not work -

java.lang.NoClassDefFoundError When Creating New Android Project -