@amiter00 if anything you've "consolidated" too much already. You'd need to do what is called "normalisation" on your data. Your tables should look like this:
chefs table
| id | name |
|----|---------|
| 1 | andy |
| 2 | brian |
| 3 | charlie |
dishes table
| id | chef_id |
|----|---------|
| 1 | 1 |
| 2 | 1 |
| 3 | 1 |
| 4 | 1 |
| 5 | 2 |
| 6 | 2 |
| 7 | 2 |
| 8 | 2 |
| 9 | 3 |
| 10 | 3 |
| 11 | 3 |
| 12 | 3 |
| 13 | 7 |
| 14 | 7 |
ingedients table
| id | name | cost |
|----|----------|------|
| 1 | potatoes | 0.3 |
| 2 | tomatoes | 0.4 |
| 3 | butter | 0.9 |
| 4 | garlic | 0.2 |
| 5 | salt | 0.05 |
| 6 | pepper | 0.05 |
| 7 | onions | 0.2 |
| 8 | leeks | 0.3 |
| 9 | carrots | 0.2 |
| 10 | peas | 0.2 |
| 11 | chili | 0.3 |
| 12 | basil | 0.3 |
| 13 | milk | 0.7 |
| 14 | cheese | 1 |
dish_ingredient pivot table
| dish_id | ingredient_id |
|---------|---------------|
| 1 | 2 |
| 1 | 3 |
| 1 | 6 |
| 1 | 8 |
| 2 | 4 |
| 2 | 8 |
| 2 | 9 |
| 2 | 11 |
| 3 | 1 |
| 3 | 4 |
| 3 | 5 |
| 4 | 6 |
| 4 | 8 |
| 4 | 12 |
You can check out the docs here regarding Eloquent relationships. This sort of stuff is pretty easy to accomplish.
You'd have three models
Chef
public function dishes() {
return $this->hasMany('App\Dish');
}
Dish
public function ingredients() {
return $this->belongsToMany('App\Ingredient');
}
Ingredient
public function dishes() {
return $this->belongsToMany('App\Dish');
}
public function dishes() {
return $this->hasMany('App\Dish');
}
Dish
public function ingredients() {
return $this->belongsToMany('App\Ingredient');
}
Ingredient
public function dishes() {
return $this->belongsToMany('App\Dish');
}
This should get you going.