EMfinanga
1 month ago
237
5
Laravel

How to create a relationship and Join table

Posted 1 month ago by EMfinanga

I want to select product from the following tables,

Products

    Id
    Name
    Category_id

Itemstock

    Id
    Item_id
    Qty
    Rate
    amount

Sales

       Id
      Item_id
       Sale_type
       Qty
       rate
      Amount

I want to select product id=3 which found on those table.

What i try

     Function item_summary(Request,$request){

      $sale = Sale:: with(items)->where(item_id, $id)

}

I dont get the data in itemstock table, how can i modify this code?

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