columns update
This commit is contained in:
parent
9e7c83b680
commit
a2284e3bf2
@ -5,7 +5,7 @@
|
||||
"id": "ID",
|
||||
"email": "Email",
|
||||
"description": "Описание 1",
|
||||
"description2": "Описание 2",
|
||||
"created_at": "Создан",
|
||||
"status": "Статус"
|
||||
},
|
||||
"actions": ["view"],
|
||||
@ -22,15 +22,15 @@
|
||||
"email", "description"
|
||||
],
|
||||
"data": [
|
||||
{"id": 1,"email":"fas1@mail.ru","description":"sdgsdfg","description2":"ffdghdas", "status": 1},
|
||||
{"id": 2,"email":"fas2@mail.ru","description":"fafdgdfgsdfdfs","description2":"ffdghdas", "status": 1},
|
||||
{"id": 3,"email":"fas3@mail.ru","description":"fafdgdssdfgdfs","description2":"ffdghdas", "status": 2},
|
||||
{"id": 4,"email":"fas4@mail.ru","description":"fafddsfgsdvcbgdfs","description2":"ffdghdas", "status": 1},
|
||||
{"id": 5,"email":"fas5@mail.ru","description":"fafdgghjgfdfs","description2":"ffdghdas", "status": 1},
|
||||
{"id": 6,"email":"fas6@mail.ru","description":"fafddfgdhvgdfs","description2":"ffdghdas", "status": 1},
|
||||
{"id": 7,"email":"fas7@mail.ru","description":"fafdfgnfdgdfs","description2":"ffdghdas", "status": 0},
|
||||
{"id": 8,"email":"fas8@mail.ru","description":"fafdfghdfgdfs","description2":"ffdghdas", "status": 1},
|
||||
{"id": 12,"email":"dfdfd@mail.ru","description":"sdffhdfhggsdfg","description2":"ffdgdfgsdfghdas", "status": 99},
|
||||
{"id": 13,"email":"dfsdfsddfd@mail.ru","description":"sdffhdfsdfshggsdfg","description2":"ffdgdsdffgsdfghdas", "status": 1}
|
||||
{"id": 1,"email":"fas1@mail.ru","description":"sdgsdfg","created_at":"2024-07-22 15:24:37", "status": 1},
|
||||
{"id": 2,"email":"fas2@mail.ru","description":"fafdgdfgsdfdfs","created_at":"2024-04-22 15:56:37", "status": 1},
|
||||
{"id": 3,"email":"fas3@mail.ru","description":"fafdgdssdfgdfs","created_at":"2024-07-27 15:24:37", "status": 2},
|
||||
{"id": 4,"email":"fas4@mail.ru","description":"fafddsfgsdvcbgdfs","created_at":"2024-07-04 15:24:37", "status": 1},
|
||||
{"id": 5,"email":"fas5@mail.ru","description":"fafdgghjgfdfs","created_at":"2024-07-13 15:24:37", "status": 1},
|
||||
{"id": 6,"email":"fas6@mail.ru","description":"fafddfgdhvgdfs","created_at":"2024-07-20 15:24:37", "status": 1},
|
||||
{"id": 7,"email":"fas7@mail.ru","description":"fafdfgnfdgdfs","created_at":"2024-06-22 15:24:37", "status": 0},
|
||||
{"id": 8,"email":"fas8@mail.ru","description":"fafdfghdfgdfs","created_at":"2023-12-12 15:12:37", "status": 1},
|
||||
{"id": 12,"email":"dfdfd@mail.ru","description":"sdffhdfhggsdfg","created_at":"2024-03-11 17:24:37", "status": 99},
|
||||
{"id": 13,"email":"dfsdfsddfd@mail.ru","description":"sdffhdfsdfshggsdfg","created_at":"2023-11-19 14:24:37", "status": 1}
|
||||
]
|
||||
}
|
@ -9,6 +9,10 @@ $table = new ListJsonTable($json);
|
||||
|
||||
//$table->columns([
|
||||
$table->columns([
|
||||
[
|
||||
'field' => 'created_at',
|
||||
'format' => 'date:d-m-Y',
|
||||
],
|
||||
'status' => function ($cell) {
|
||||
return getStatusLabel()[$cell];
|
||||
},
|
||||
|
@ -287,10 +287,21 @@ class ListJsonTable extends JasonTable
|
||||
}
|
||||
}
|
||||
|
||||
// public function columns(array $data): void
|
||||
// {
|
||||
// foreach ($data as $key => $value) {
|
||||
// $this->beforePrintCell[$key] = $value;
|
||||
// }
|
||||
// }
|
||||
|
||||
public function columns(array $data): void
|
||||
{
|
||||
foreach ($data as $key => $value) {
|
||||
$this->beforePrintCell[$key] = $value;
|
||||
foreach ($value as $currentKey => $currentValue) {
|
||||
echo "<pre>";
|
||||
print_r($currentValue);
|
||||
// die();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user