<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Models\User;
use Illuminate\Support\Facades\DB;

class affliateBackend extends Controller
{
    public function allAffiliates()
    {

        return view('affiliates.all');

    }

    public function activeAffiliates()
    {
        

     $managers = User::withCount('referrals')
    ->having('referrals_count', '>', 5)
    ->orderByDesc('referrals_count')
    ->get();
    
       
        return view('affiliates.active')->with('managers', $managers);
    }
    public function dormantAffiliates()
    {
        return view('affiliates.dormant');
    }


}
