user table

This commit is contained in:
Kavalar 2024-07-30 12:27:44 +03:00
parent f24ce58b85
commit 9fb72b7840
5 changed files with 14 additions and 10 deletions

View File

@ -61,9 +61,7 @@ class UserController extends Controller{
*/
public function actionIndex(): void
{
// $users = User::where(['role' => 1])->get();
$users = User::all();
//App::$header->add("asd", "asd");
$this->cgView->render("user/index.php", ['users' => $users]);
}

6
composer.lock generated
View File

@ -851,11 +851,11 @@
},
{
"name": "itguild/tables",
"version": "0.1.6",
"version": "0.1.7",
"source": {
"type": "git",
"url": "https://git.itguild.info/ItGuild/tables",
"reference": "48e6d645d97ace1eec258819da758f53db0b7d46"
"reference": "b7fea4122c25d8ba9eafd58c07d65e829ea4c383"
},
"type": "library",
"autoload": {
@ -873,7 +873,7 @@
"email": "apuc06@mail.ru"
}
],
"time": "2024-07-23T12:17:16+00:00"
"time": "2024-07-30T09:20:16+00:00"
},
{
"name": "madesimple/php-arrays",

View File

@ -22,8 +22,9 @@ class App
{
$dispatcher = new Dispatcher(App::$collector->getData());
$response = $dispatcher->dispatch($_SERVER['REQUEST_METHOD'], parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH));
//header('Content-Type: ' . App::$responseType);
App::$header->set();
//header('Content-Type: ' . App::$responseType);
echo $response;
}

View File

@ -11,14 +11,14 @@ namespace kernel;
class Header
{
protected $list = [];
protected array $list = [];
public function add($key, $value)
public function add($key, $value): void
{
$this->list[$key] = $value;
}
public function set()
public function set(): void
{
foreach ($this->list as $key=>$v){
header($key . ": " . $v);

View File

@ -19,10 +19,15 @@ $dataProvider = new ListJsonTableEloquentCollection($users, [
'baseUrl' => "/admin/user",
]);
$table = new ListJsonTable($dataProvider->getJson());
$table->beforePrint(function (){
$table->beforePrint(function () {
return PrimaryBtn::create("Создать", "/admin/user/create")->fetch();
//return (new PrimaryBtn("Создать", "/admin/user/create"))->fetch();
});
$table->afterPrint(function () use ($users) {
$pagination = new \Itguild\Tables\Pagination($users->count(), 5, 1, "/admin/user/");
$pagination->create();
return $pagination->fetch();
});
$table->addAction(UserViewActionColumn::class);
$table->addAction(UserEditActionColumn::class);
$table->addAction(UserDeleteActionColumn::class);