<?php
use Encore\Admin\Facades\Admin;
use Encore\Admin\Layout\Content;
use App\Http\Controllers\Controller;
use Encore\Admin\Widgets\Box;
use Encore\Admin\Widgets\Table;
class ExampleController extends Controller
{
public function table()
{
return Admin::content(function (Content $content) {
$content->header('Table1');
// table 1
$headers = ['Id', 'Email', 'Name', 'age', 'Company'];
$rows = [
[1, '[email protected]', 'Ms. Clotilde Gibson', 25, 'Goodwin-Watsica'],
[2, '[email protected]', 'Allie Kuhic', 28, 'Murphy, Koepp and Morar'],
[3, '[email protected]', 'Prof. Drew Heller', 35, 'Kihn LLC'],
[4, '[email protected]', 'William Koss', 20, 'Becker-Raynor'],
[5, '[email protected]', 'Ms. Antonietta Kozey Jr.', 41, 'MicroBist'],
];
$table = new Table($headers, $rows);
$content->row((new Box('表格', $table))->style('info')->solid());
$headers = ['Keys', 'Values'];
$rows = [
'name' => 'Joe',
'age' => 25,
'gender' => 'Male',
'birth' => '1989-12-05',
];
$table = new Table($headers, $rows);
$content->row((new Box('表格', $table))->style('danger')->solid());
});
}
}