5 months ago

get users data

Posted 5 months ago by rully

public function topsales(){ $users = DB::table('results') ->select(DB::raw('count(*) as sales_count, salescode')) ->where('salescode', '<>', 1) ->groupBy('salescode') ->orderBy('sales_count', 'desc') ->take(10) ->get();

    if (true) {
      return response()->json([
        'sales top 3' => $users,

i have two tables. results and user. from the results table, there are sales sales results,and i want to sort the most sales result tables and retrieve sales user data that sells them, but i can only get salescode. how can all the sales data appear

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