35 lines
823 B
PHP
35 lines
823 B
PHP
<?php
|
|
|
|
/**
|
|
* @var App\Models\User $user
|
|
*/
|
|
|
|
use Itguild\EloquentTable\ViewEloquentTable;
|
|
use Itguild\EloquentTable\ViewJsonTableEloquentModel;
|
|
|
|
$table = new ViewEloquentTable(new ViewJsonTableEloquentModel($user, [
|
|
'params' => ["class" => "table table-bordered", "border" => "2"],
|
|
'baseUrl' => "/admin/user",
|
|
]));
|
|
$table->rows([
|
|
'user_photo' => function ($data) {
|
|
return $data ? "<img src='$data' width='300px'>" : "";
|
|
},
|
|
'created_at' => function ($data) {
|
|
if (!$data) {
|
|
return null;
|
|
}
|
|
|
|
return (new DateTimeImmutable($data))->format("d-m-Y");
|
|
},
|
|
'updated_at' => function ($data) {
|
|
if (!$data) {
|
|
return null;
|
|
}
|
|
|
|
return (new DateTimeImmutable($data))->format("d-m-Y");
|
|
}
|
|
]);
|
|
$table->create();
|
|
$table->render();
|