Here are my tables.
╔════════════╤═╤══════════╤═╤═══════╗
║ Insurances │ │ Devices │ │ Brands║
╠════════════╪═╪══════════╪═╪═══════╣
║ id │ │ id │ │ id ║
╟────────────┼─┼──────────┼─┼───────╢
║ IMEI │ │ type │ │ name ║
╟────────────┼─┼──────────┼─┼───────╢
║ device_id │ │ name │ │ ║
╟────────────┼─┼──────────┼─┼───────╢
║ user_id │ │ brand_id │ │ ║
╚════════════╧═╧══════════╧═╧═══════╝
now I wanna show the results data in a table like
╔══════╤════════════╤═════════════╤══════════════╤═════════╗
║ IMEI │ brand_name │ device_name │ device_price │ user_id ║
╚══════╧════════════╧═════════════╧══════════════╧═════════╝
Imagine if it is AJAX and I have to join the tables before sending the data to the view. I have defined the relationships in models. but with the with()
method I only can call 2 of em the same time and yet I dunno how to call them in the view.
Are there anyways to not use plain DB::class
and just use eloquent?