There are three tables in the database: species, panel, and a cross table called species_panel. The relationship between them is that one panel can contain multiple species, so a one-to-many relationship is used. Data needs to be inserted into the panel table with names and descriptions, while the species table remains unchanged. Additionally, data should be inputted into the cross table.
Issues encountered: - Key added for the panel table but values like name and description showing NULL instead of actual data. - Nothing gets inserted into the cross table.
Need help identifying why the data cannot be inserted as expected. Appreciate any insights or solutions provided. Thank you.
The species table
+----+-----------------+
| id | name |
+----+-----------------+
| 1 | Spider Monkey |
+----+-----------------+
| 2 | Squirrel Monkey |
+----+-----------------+
| 3 | Vervet Monkey |
+----+-----------------+
| 4 | Dorset Horn |
+----+-----------------+
| 5 | Dorper |
+----+-----------------+
| 6 | Javan Warty Pig |
+----+-----------------+
| 7 | Wild Boar |
+----+-----------------+
Data structure for other tables:
Panel table
+----+------+-------------+
| id | name | description |
+----+------+-------------+
| 1 | P001 | Monkeys |
+----+------+-------------+
| 2 | P002 | Sheeps |
+----+------+-------------+
| 3 | P003 | Porks |
+----+------+-------------+
species_panel table
+----+----------+---------+
| id | panel_id | species |
+----+----------+---------+
| 1 | 1 | 1 |
+----+----------+---------+
| 2 | 1 | 2 |
+----+----------+---------+
| 3 | 1 | 3 |
+----+----------+---------+
| 4 | 2 | 4 |
+----+----------+---------+
| 5 | 2 | 5 |
+----+----------+---------+
| 6 | 3 | 6 |
+----+----------+---------+
| 7 | 3 | 7 |
+----+----------+---------+
Code from species.vue file:
species.vue
(The content inside the code block represents sample code snippet.)
Part of JavaScript code:
Part of JavaScript
(The content inside the code block represents sample code snippet.)
species.php
(The content inside the code block represents sample code snippet.)
panel.php
(The content inside the code block represents sample code snippet.)
index.blade.php
(The content inside the code block represents sample code snippet.)
PanelController.php
(The content inside the code block represents sample code snippet.)