Dashboard.php 800 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace App\Http\Livewire;
  3. use Livewire\Component;
  4. use Carbon\Carbon;
  5. class Dashboard extends Component
  6. {
  7. public $totMembers = 0;
  8. public $totSuppliers = 0;
  9. public $totTodayIn = 0;
  10. public $totTodayOut = 0;
  11. public $dayName;
  12. public function render()
  13. {
  14. return view('livewire.dashboard');
  15. }
  16. public function mount()
  17. {
  18. $this->dayName = Carbon::now()->locale('it_IT')->dayName;
  19. $this->totMembers = \App\Models\Member::count();
  20. $this->totSuppliers = \App\Models\Supplier::count();
  21. $this->totTodayIn = \App\Models\Record::where('type', 'IN')->where('date', date("Y-m-d"))->sum('amount');
  22. $this->totTodayOut = \App\Models\Record::where('type', 'OUT')->where('date', date("Y-m-d"))->sum('amount');
  23. }
  24. }