9 months ago

Reference two columns on another table or reference the id?

Posted 9 months ago by midwestdev

I have a parent called formula_items that will have many ingredient, and it has a parent that will have many formulas I don't want to have to add ingredients each time so I want to include a dropdown that list the ingredients and when you create the formula item it will reference the ingredients. (doing it this way in case later the ingredients change in some fashion, it will just cascade down to all the formulas and formula items.

I am probably over complicating in my head a simple one to one relationship as I haven't slept in 20 hours, but this is my UP migration.

public function up()
    Schema::create('formula_items', function (Blueprint $table) {

I am pretty certain this is right, but if I am wrong I would appreciate some advice on how I can rethink this?

Please sign in or create an account to participate in this conversation.