Laravel relationship model এ belongsToMany vs hasManyThrough কোনটা কবে ব্যবহার করবো?

আমি confused belongsToMany আর hasManyThrough এর মধ্যে। কবে কোনটা ব্যবহার করা উচিত?
1 Answer
Answered by Ibrahim | 1 month ago

belongsToMany তখন ব্যবহার হয় যখন দুইটি মডেলের মধ্যে many-to-many সম্পর্ক থাকে। আর hasManyThrough তখন ব্যবহার হয় যখন আপনি কোনো model থেকে অন্য model পর্যন্ত একাধিক মডেলের মাধ্যমে access করতে চান।

Sign up or log in