invoiceninja/app/Http/Livewire/DownloadsTable.php
2020-08-17 16:18:49 +02:00

27 lines
562 B
PHP

<?php
namespace App\Http\Livewire;
use App\Models\Document;
use App\Utils\Traits\WithSorting;
use Livewire\Component;
use Livewire\WithPagination;
class DownloadsTable extends Component
{
use WithPagination, WithSorting;
public $per_page = 10;
public function render()
{
$query = Document::query()
->orderBy($this->sort_field, $this->sort_asc ? 'asc' : 'desc')
->paginate($this->per_page);
return render('components.livewire.downloads-table', [
'downloads' => $query,
]);
}
}