igfs/app/modules/module_shop/views/view.php
2024-10-17 11:35:56 +03:00

30 lines
941 B
PHP

<?php
/**
* @var Collection $module
*/
use Illuminate\Database\Eloquent\Collection;
use kernel\modules\user\models\User;
use Itguild\EloquentTable\ViewEloquentTable;
use Itguild\EloquentTable\ViewJsonTableEloquentModel;
use kernel\IGTabel\btn\DangerBtn;
use kernel\IGTabel\btn\PrimaryBtn;
use kernel\IGTabel\btn\SuccessBtn;
$table = new ViewEloquentTable(new ViewJsonTableEloquentModel($module, [
'params' => ["class" => "table table-bordered", "border" => "2"],
'baseUrl' => "/admin/module_shop",
]));
$table->beforePrint(function () use ($module) {
$btn = PrimaryBtn::create("Список", "/admin/module_shop")->fetch();
$btn .= DangerBtn::create("Удалить", "/admin/module_shop/delete/" . $module->id)->fetch();
return $btn;
});
$table->rows([
'status' => (function ($data) {
return \app\modules\module_shop\models\ModuleShop::getStatus()[$data];
})
]);
$table->create();
$table->render();