Update ShowTop.php
This commit is contained in:
@@ -18,29 +18,36 @@ class ShowTop extends Component
|
||||
use LivewireAlert;
|
||||
|
||||
public function render()
|
||||
{
|
||||
$this->configuracion = Configuracione::orderby('id', 'desc')->first();
|
||||
{
|
||||
$this->configuracion = Configuracione::orderby('id', 'desc')->first();
|
||||
|
||||
$monthYear = date('m-Y', strtotime('last month'));
|
||||
$month = $this->showLastMonth ? date('m', strtotime('last month')) : date('m');
|
||||
$currentYear = date('Y');
|
||||
$monthYear = date('m-Y', strtotime('last month'));
|
||||
$month = $this->showLastMonth ? date('m', strtotime('last month')) : date('m');
|
||||
|
||||
$consulta_ventas = User::with(['historiales_venta' => function ($query) use ($month) {
|
||||
$query->whereMonth('fecha_inicio', $month)->where('estado', 'activo');
|
||||
}])
|
||||
->withCount(['historiales_venta' => function ($query) use ($month) {
|
||||
$query->whereMonth('fecha_inicio', $month);
|
||||
}])
|
||||
->orderBy('historiales_venta_count', 'desc')
|
||||
->limit(10)
|
||||
->get();
|
||||
$consulta_ventas = User::with(['historiales_venta' => function ($query) use ($month, $currentYear) {
|
||||
$query->whereMonth('fecha_inicio', $month)
|
||||
->whereYear('fecha_inicio', $currentYear)
|
||||
->where('estado', 'activo');
|
||||
}])
|
||||
->withCount(['historiales_venta' => function ($query) use ($month, $currentYear) {
|
||||
$query->whereMonth('fecha_inicio', $month)
|
||||
->whereYear('fecha_inicio', $currentYear);
|
||||
}])
|
||||
->orderBy('historiales_venta_count', 'desc')
|
||||
->limit(10)
|
||||
->get();
|
||||
|
||||
$consultaPremioEntregado = PremioEntregado::where('fecha', $monthYear)->first();
|
||||
$consultaPremioEntregado = PremioEntregado::whereYear('fecha', $currentYear)
|
||||
->where('fecha', $monthYear)
|
||||
->first();
|
||||
|
||||
return view('livewire.show-top', [
|
||||
'usuarios' => $consulta_ventas,
|
||||
'consultaPremioEntregado' => $consultaPremioEntregado
|
||||
]);
|
||||
}
|
||||
|
||||
return view('livewire.show-top', [
|
||||
'usuarios' => $consulta_ventas,
|
||||
'consultaPremioEntregado' => $consultaPremioEntregado
|
||||
]);
|
||||
}
|
||||
|
||||
public function entregarPremio()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user