samedi 17 juillet 2021

i found some syntax error using where function in query (laravel)

i have two condition which i want to implement in a query but when i used i found some systax error but i did not how to solved it. error in the below:

syntax error, unexpected '}'

and my controller code is :

public function paymentHubList(Request $request, $id){
        $Abc = new Abc();

        $Abc = $Abc->where('status_id','1')->where('payment','1')
                        ->where(function($query){
                            $query->where(function($query){
                                 $query->where('delivery',$id)->where('paid','!=','0');
                             })
                            ->orWhere(function($query){
                                 $query->where('branch',$id)->where('paid', '0');
                             })
                         })

                    ->orderBy('id','desc')->paginate(100);
        dd($Abc);

    }

in the where function i want to execute a and or condition. in the below i gave the condition:

@if((($Abc->delivery == $id) && ($Abc->paid != '0')) || ($Abc->branch == $id) && ($Abc->paid == '0'))


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire