Mysql
 sql >> Datenbank >  >> RDS >> Mysql

Laravel LeftJoin where

Ich löse dieses Problem mit diesem Code

 $query = Worker::select('workers.name_and_surname', 'workers.id', 'workers.location','company_saved_cv.worker_id')
        ->leftJoin('company_saved_cv', function($leftJoin)use($company_id)
        {
            $leftJoin->on('workers.id', '=', 'company_saved_cv.worker_id');
            $leftJoin->on(DB::raw('company_saved_cv.company_id'), DB::raw('='),DB::raw("'".$company_id."'"));


        })