Well, I need some urgent help!
I have the following situation:
Tables:
saidas
id
...
saidas_produto
id_saida
id_entrada_produto
entradas_produtos
id
id_entrada
id_produto
...
entradas
id
...
My warehouse system works with incoming and outgoing multiple products. Where an output is made to an item that was added to the input (input_products) - > here is where the items (products) of the entry are stored. In other words, an output is not directly related to a product, but to a product that has been entered.
I was able to make the right relationship to the entry:
public function produtos() {
return $this->belongsToMany('Estoque\Produto', 'entradas_produtos', 'id_entrada', 'id_produto')->withPivot('id', 'numero_lote', 'vencimento_lote', 'quantidade', 'valor_unitario')->orderBy('entradas_produtos.id', 'asc');
}
How do I make this relationship by going through the outputs_products table, picking up my product that is inside inputs_products and picking up the name of the product that is inside products?
I have tried everything and nothing: (