added migration, model, resource , grid table
This commit is contained in:
40
app/Livewire/InvoiceDataTable.php
Normal file
40
app/Livewire/InvoiceDataTable.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Livewire;
|
||||
|
||||
use App\Models\InvoiceValidation;
|
||||
use Livewire\Component;
|
||||
|
||||
class InvoiceDataTable extends Component
|
||||
{
|
||||
|
||||
public $invoiceData = [];
|
||||
|
||||
protected $listeners = ['refreshInvoiceData' => 'loadData'];
|
||||
|
||||
public function mount()
|
||||
{
|
||||
$this->loadData();
|
||||
|
||||
}
|
||||
|
||||
public function loadData()
|
||||
{
|
||||
$this->invoiceData = InvoiceValidation::all()->toArray();
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
// Always fetch fresh data when Livewire re-renders (like via polling)
|
||||
$invoiceData = InvoiceValidation::latest()->get();
|
||||
|
||||
return view('livewire.invoice-data-table', [
|
||||
'invoiceData' => $invoiceData,
|
||||
]);
|
||||
// return view('livewire.invoice-data-table', [
|
||||
// 'invoiceData' => $this->invoiceData, // <--- this is important
|
||||
// ]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user