'Laravel eloquent relation fetch data mapping through

batch_master : id, name batch_coach_mapping : id, batch_master_id, user_id users: id, name Now, Fetching record from batch_master with users: Can anyone suggest eloquent relationship & how to use it with batch_master model ?

Above are the tables

For example $batch_master = BatchMaster::with(['batch_master_days_mapping', 'franchise', 'current_user'])->where('id', '<>', null);



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source