zaster
8 months ago

Updating a table property through a relationship

Posted 8 months ago by zaster

I have tried this and it worked for po_items but not for cost_items. I didn't try the regular way for cost_items yet

         foreach ($po_items as $po_item) {
            $po_item->status = 1;
            $po_item->cost_item->status = 1;
            $cost_item->save();
            $po_item->save();
        }

is there any easy way of doing something like the above mentioned

po_item and cost_item has a one to one relationship

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