I am using YajraDatatables in the controller and it's working fine, Below is the controller function, and it give me output in table,
class EodBhavDataController extends Controller
{
//
public function index(EodBhavDataTable $dataTable)
{
return $dataTable->render('pages/apps.eodbhavdata.list');
}
}
and the same can be viewed in the blade below,
<div class="table-responsive">
{{ $dataTable->table() }}
</div>
Now what I did in the Livewire component is below, I am passing component property to YajraDatatables EodBhavDataTable and getting $dataTable as query output.
//Livewire component file.
class Trades extends Component
{
public $property;
public $dataTable;
public function mount($property)
{
$this->property = $property;
}
public function render(EodBhavDataTable $dataTable)
{
$this->dataTable = $this->property;
$outputTable = $dataTable->render('pages/apps.eodbhavdata.list');
return view('livewire.symbol.trades', ['table' => $outputTable]);
}
}
//livewire.symbol.trades file.
<div class="table-responsive">
{{ $table->table() }}
</div>
Now I want to output the same table via the Livewire blade, but it is not showing table output but shows an error Call to a member function table() on string
So the question is, how do we pass the YajraDatables render table via the Livewire component?