mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-14 15:13:29 +01:00
51 lines
1.0 KiB
PHP
51 lines
1.0 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Invoice Ninja (https://invoiceninja.com).
|
|
*
|
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
*
|
|
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
|
*
|
|
* @license https://www.elastic.co/licensing/elastic-license
|
|
*/
|
|
|
|
namespace App\Http\Livewire;
|
|
|
|
use App\Libraries\MultiDB;
|
|
use App\Models\Client;
|
|
use App\Utils\Traits\WithSorting;
|
|
use Livewire\Component;
|
|
use Livewire\WithPagination;
|
|
|
|
class DocumentsTable extends Component
|
|
{
|
|
use WithPagination, WithSorting;
|
|
|
|
public $client;
|
|
|
|
public $per_page = 10;
|
|
|
|
public $company;
|
|
|
|
public function mount($client)
|
|
{
|
|
|
|
MultiDB::setDb($this->company->db);
|
|
|
|
$this->client = $client;
|
|
}
|
|
|
|
public function render()
|
|
{
|
|
$query = $this->client
|
|
->documents()
|
|
->orderBy($this->sort_field, $this->sort_asc ? 'asc' : 'desc')
|
|
->paginate($this->per_page);
|
|
|
|
return render('components.livewire.documents-table', [
|
|
'documents' => $query,
|
|
]);
|
|
}
|
|
}
|