34 lines
1.2 KiB
PHP
Raw Normal View History

2024-10-15 17:32:33 +03:00
<?php
/**
2024-10-16 16:06:25 +03:00
* @var \Illuminate\Database\Eloquent\Collection $module
2024-10-15 17:32:33 +03:00
* @var int $page_number
*/
2024-10-16 16:06:25 +03:00
use app\modules\module_shop\models\ModuleShop;
2024-10-15 17:32:33 +03:00
use Itguild\EloquentTable\EloquentDataProvider;
use Itguild\EloquentTable\ListEloquentTable;
2024-10-17 11:35:56 +03:00
use kernel\IGTabel\action_column\DeleteActionColumn;
use kernel\IGTabel\action_column\ViewActionColumn;
2024-10-15 17:32:33 +03:00
use kernel\IGTabel\btn\PrimaryBtn;
$table = new ListEloquentTable(new EloquentDataProvider(\app\modules\module_shop\models\ModuleShop::class, [
'currentPage' => $page_number,
'perPage' => 8,
'params' => ["class" => "table table-bordered", "border" => "2"],
2024-10-16 16:06:25 +03:00
'baseUrl' => "/admin/module_shop",
2024-10-15 17:32:33 +03:00
]));
2024-10-16 16:06:25 +03:00
$table->columns([
'status' => function ($data) {
return ModuleShop::getStatus()[$data];
}
]);
2024-10-15 17:32:33 +03:00
$table->beforePrint(function () {
2024-12-19 12:53:55 +03:00
$btn = PrimaryBtn::create("Добавить модуль", "/admin/module_shop/module/create", width: '200px')->fetch();
$btn .= PrimaryBtn::create("Добавить ядро", "/admin/module_shop/kernel/create", '400px')->fetch();
2024-12-18 12:46:57 +03:00
return $btn;
2024-10-15 17:32:33 +03:00
});
2024-10-17 11:35:56 +03:00
$table->addAction(ViewActionColumn::class);
$table->addAction(DeleteActionColumn::class);
2024-10-15 17:32:33 +03:00
$table->create();
$table->render();