ExternalDataTable.php 561 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. namespace App\Filament\Tables;
  3. use Filament\Tables\Table;
  4. use Illuminate\Database\Eloquent\Model;
  5. use Illuminate\Support\Collection;
  6. class ExternalDataTable extends Table
  7. {
  8. protected Collection $records;
  9. public function setRecords(Collection $records): static
  10. {
  11. $this->records = $records;
  12. return $this;
  13. }
  14. public function getRecords(): Collection
  15. {
  16. return $this->records ?? new Collection();
  17. }
  18. public function getTotalRecords(): ?int
  19. {
  20. return $this->getRecords()->count();
  21. }
  22. }