laravel selectRaw

Posted 2 months ago by mouzak

hello i need help please, i add several columns. the result is good, but if one of the columns is null, the query does not return a result. How to solve this problem. Thank you.

public function B_paie( Request $request) { $data=array();

    $data['paies' ]= DB::table('salaries')
            ->leftJoin( 'paie','', '=', 'paie.idsalaries')
            ->leftJoin( 'primes','', '=', 'primes.idsalaries')
            ->select('salaries.*', 'paie.*','primes.*')
        ->selectRaw('(salairebase + sursalaire + primetransport + congepaye + autreprimes) as total')
            ->where('', $request->id)
           return view('bulletin_paie',compact("data"));


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

Reply to

Use Markdown with GitHub-flavored code blocks.