Answer the question
In order to leave comments, you need to log in
How to make a request to the database?
There is a table of products. This table has many-to-many relationships with 3 other tables "color", "weight", "growth".
Schematically:
produkts <-> products_color <-> color
<-> products_weight <-> weight
<-> products_growth <-> growth
produkts 1 => [
name => produkts 1,
slug => produkts 1,
color => [
[0] => red
[1] =>blak
],
weight => [
[0] => 100
[1] => 200
],
growth => [
[0] => 150
[1] => 250
],
],
produkts 2 => [
name => produkts 2,
slug => produkts 2,
color => [
[0] => red
],
weight => [
[0] => 100
],
growth => [
],
].....
Answer the question
In order to leave comments, you need to log in
https://laravel.com/docs/5.6/eloquent-relationship...
https://laravel.com/docs/5.6/eloquent-relationship...
$produkts = App\Produkts::with(['color', 'weight', 'growth'])->get();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question