2020-04-23 00:49:23 +02:00
|
|
|
<?php
|
|
|
|
|
2020-12-05 14:24:21 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
2020-04-23 00:49:23 +02:00
|
|
|
namespace App\Http\Livewire;
|
|
|
|
|
2021-06-07 03:06:31 +02:00
|
|
|
use App\Libraries\MultiDB;
|
2020-04-23 00:49:23 +02:00
|
|
|
use App\Models\ClientGatewayToken;
|
2020-05-04 23:22:31 +02:00
|
|
|
use App\Utils\Traits\WithSorting;
|
2020-04-23 00:49:23 +02:00
|
|
|
use Livewire\Component;
|
|
|
|
use Livewire\WithPagination;
|
|
|
|
|
|
|
|
class PaymentMethodsTable extends Component
|
|
|
|
{
|
|
|
|
use WithPagination;
|
|
|
|
use WithSorting;
|
|
|
|
|
|
|
|
public $per_page = 10;
|
2021-06-07 03:06:31 +02:00
|
|
|
|
2020-04-23 00:49:23 +02:00
|
|
|
public $client;
|
|
|
|
|
2021-06-07 03:06:31 +02:00
|
|
|
public $company;
|
|
|
|
|
2020-04-23 00:49:23 +02:00
|
|
|
public function mount($client)
|
|
|
|
{
|
2021-06-07 03:06:31 +02:00
|
|
|
|
|
|
|
MultiDB::setDb($this->company->db);
|
|
|
|
|
2020-04-23 00:49:23 +02:00
|
|
|
$this->client = $client;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function render()
|
|
|
|
{
|
|
|
|
$query = ClientGatewayToken::query()
|
|
|
|
->with('gateway_type')
|
2021-07-03 23:46:25 +02:00
|
|
|
->where('company_id', $this->company->id)
|
2020-04-23 00:49:23 +02:00
|
|
|
->where('client_id', $this->client->id)
|
|
|
|
->orderBy($this->sort_field, $this->sort_asc ? 'asc' : 'desc')
|
2021-09-10 21:48:35 +02:00
|
|
|
->withTrashed()
|
2020-04-23 00:49:23 +02:00
|
|
|
->paginate($this->per_page);
|
|
|
|
|
|
|
|
return render('components.livewire.payment-methods-table', [
|
|
|
|
'payment_methods' => $query,
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|