ver el mes pasado
This commit is contained in:
@@ -8,27 +8,30 @@ use Livewire\Component;
|
||||
use Jantinnerezo\LivewireAlert\LivewireAlert;
|
||||
|
||||
class ShowTop extends Component
|
||||
{ public $configuracion;
|
||||
{
|
||||
public $configuracion;
|
||||
public $showLastMonth = false;
|
||||
|
||||
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'));
|
||||
{
|
||||
$this->configuracion = Configuracione::orderby('id', 'desc')->first();
|
||||
|
||||
$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);
|
||||
}])
|
||||
->withCount(['historiales_venta' => function ($query) {
|
||||
$query->whereMonth('fecha_inicio', date('m'));
|
||||
}])
|
||||
->orderBy('historiales_venta_count', 'desc')
|
||||
->limit(10)
|
||||
->get();
|
||||
|
||||
|
||||
->withCount(['historiales_venta' => function ($query) use ($month) {
|
||||
$query->whereMonth('fecha_inicio', $month);
|
||||
}])
|
||||
->orderBy('historiales_venta_count', 'desc')
|
||||
->limit(10)
|
||||
->get();
|
||||
|
||||
//dd($consulta_ventas);
|
||||
return view('livewire.show-top',[
|
||||
return view('livewire.show-top', [
|
||||
'usuarios' => $consulta_ventas,
|
||||
]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user