'İzin hatası']); exit(); } // weld_logs tablosunda olup line_lists tablosunda olmayan kayıtları bulalım $query = DB::table('weld_logs') ->select( 'weld_logs.id', DB::raw('COALESCE(weld_logs.line_number, \'\') as line_number'), DB::raw('COALESCE(weld_logs.design_area, \'\') as design_area') ) ->whereNotExists(function ($query) { $query->select(DB::raw(1)) ->from('line_lists') ->whereRaw('line_lists.line_no = weld_logs.line_number AND line_lists.unit = weld_logs.design_area'); }); // Tüm verileri getir $result = $query->groupBy('line_number', 'design_area')->get(); $totalCount = count($result); // Sonucu JSON olarak döndür echo json_encode([ 'data' => $result, 'totalCount' => $totalCount ]);