36 lines
907 B
PHP
36 lines
907 B
PHP
<?php
|
|
|
|
namespace App\Http\Livewire;
|
|
|
|
use App\Models\Configuracione;
|
|
use App\Models\User;
|
|
use Livewire\Component;
|
|
use Jantinnerezo\LivewireAlert\LivewireAlert;
|
|
|
|
class ShowTop extends Component
|
|
{ public $configuracion;
|
|
|
|
use LivewireAlert;
|
|
|
|
public function render()
|
|
{
|
|
$this->configuracion = Configuracione::orderby('id','desc')->first();
|
|
|
|
$consulta_ventas = User::with(['historiales_venta' => function ($query) {
|
|
$query->whereMonth('fecha_inicio', date('m'));
|
|
}])
|
|
->withCount(['historiales_venta' => function ($query) {
|
|
$query->whereMonth('fecha_inicio', date('m'));
|
|
}])
|
|
->orderBy('historiales_venta_count', 'desc')
|
|
->limit(10)
|
|
->get();
|
|
|
|
|
|
//dd($consulta_ventas);
|
|
return view('livewire.show-top',[
|
|
'usuarios' => $consulta_ventas,
|
|
]);
|
|
}
|
|
}
|