#
Make Table
#
Start Make a Table
For make a table in panel, You must:
use T0team\LaravelPanel\Facades\Panel;
$headers = [
'id' => 'ID',
'name' => 'Name',
'email' => 'Email',
'created_at' => 'Created At',
'updated_at' => 'Updated At',
];
# keys of $headers array is key name of data(rows)
# values of $headers array is title of column in table
$panel = Panel::table($headers);
#
Add Header
You can add header to table by header
& headers
methods:
$panel->header('id', 'ID');
# or
$panel->headers(['id' => 'ID', 'name' => 'Name'])
These Items are added to the end of the previous items
#
Add Row
You can add rows to table by row
& rows
methods:
$panel->row($user);
# or
$panel->rows($users);
#
Use with paginate
You can use with paginate by paginate
method:
$panel->paginate(User::paginate(10));
This method is remove all rows and add new rows with paginate
#
Add Action Button
You can add action button to each row by action
method:
use T0team\LaravelPanel\Controllers\Button;
$panel->action(Button::make()->label('buttonText')->...);
See Button guide to know how to use Button
class.
#
Render Table
You can render table by render
method:
return $panel->render();
#
Other Methods
Also you can use all methods of Panel Facade in this section.