EMfinanga
1 month ago

select multiple where in

Posted 1 month ago by EMfinanga

hello how can i write this sql in laravel

                      SELECT `created_at`,`l_type`,`vch_no`,`item_id`,`quantity`,`rate`,`amount` FROM 
                    `cash_sales` WHERE `l_type`in ('credit_sale','cash_sale') AND item_id=3

i try this but got error

                  public function stock_summary(Request $request){

                  $inwards=CashSales::with('customer_cash','items','store')
                 ->SELECT( `created_at`,`l_type`,`vch_no`,`item_id`,`quantity`,`rate`,`amount`) 
                 ->WhereIn( `l_type`, 'credit_sale','cash_sale')
                 ->where('item_id', $id)
                ->get();

error

             Symfony\Component\Debug\Exception\FatalThrowableError
                  Argument 1 passed to Illuminate\Database\Query\Builder::cleanBindings() must be of the type 
                 array, string given, called in 
                  
             C:\xampp\htdocs\accounts\vendor\laravel\framework\src\Illuminate\Database\Query\Builder.php on line 907

                        return view('stock_summary.show',compact('inwards'));
                  }

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