Update source into github
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Livewire;
|
||||
|
||||
use App\Models\Invoice;
|
||||
use App\Repositories\Invoice\InvoiceRepositoryInterface;
|
||||
use Livewire\Component;
|
||||
use Livewire\WithoutUrlPagination;
|
||||
use Livewire\WithPagination;
|
||||
|
||||
class MyService extends Component
|
||||
{
|
||||
use WithPagination, WithoutUrlPagination;
|
||||
|
||||
public int|string $status = 'full';
|
||||
public $type = '';
|
||||
public $search = '';
|
||||
protected $invoiceRepository;
|
||||
|
||||
public function mount(InvoiceRepositoryInterface $invoiceRepository)
|
||||
{
|
||||
$this->invoiceRepository = $invoiceRepository;
|
||||
}
|
||||
|
||||
public function updatedSearch()
|
||||
{
|
||||
$this->resetPage();
|
||||
}
|
||||
|
||||
public function updatedStatus()
|
||||
{
|
||||
$this->resetPage();
|
||||
}
|
||||
|
||||
public function updatedType()
|
||||
{
|
||||
$this->resetPage();
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
$query = Invoice::where('customer_id', customer()->id)
|
||||
->with([
|
||||
'invoiceItem.hosting',
|
||||
'invoiceItem.vps',
|
||||
'invoiceItem.os.osGroup',
|
||||
'invoiceItem.addons.addonItems'
|
||||
]);
|
||||
|
||||
// Filter by type if specified
|
||||
if (!empty($this->type)) {
|
||||
$query->whereHas('invoiceItem', function($q) {
|
||||
$q->where('product_type', $this->type);
|
||||
});
|
||||
}
|
||||
|
||||
// Filter by server_name search if specified
|
||||
if (!empty($this->search)) {
|
||||
$query->whereHas('invoiceItem', function($q) {
|
||||
$q->where('server_name', 'like', '%' . $this->search . '%');
|
||||
});
|
||||
}
|
||||
|
||||
return view('livewire.my-service', [
|
||||
'services' => $query->orderBy('created_at', 'desc')->paginate(10)
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user