laravel-table
laravel-table copied to clipboard
Assign Id to table ?
How can I assign an id to a table. I am creating a table like
return view('admin.booking.list', [ 'table' => \App::make('table')->create($this->getBookingManager()->getAllByAdmin()) ]);
There's currently no way to do this short of creating a custom view and hard-coding the ID, like so:
$table = Table::create();
$table->setView('tables/custom_table');
// views/tables/custom_table.blade.php:
<table class="{{ $class or 'table' }}" id="assigned_id">
// ...copy the rest of the file from the default view
I will leave this issue open so that ID setting can be included in a future release.
right now, I'm creating table this way by sending array of objects to the view.. `<?php if ($table->getRows()->count()) {
$table->setColumns(['shop_id']);
$table->addColumn('unhashed_password', 'Password');
$table->addColumn('system', 'Shop System', function ($model) {
if ($model->system) {
return $model->system->name;
}
return '';
});
}`