igfs/app/modules/module_shop/views/view.php
2024-10-16 16:06:25 +03:00

31 lines
1.0 KiB
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 .= SuccessBtn::create("Редактировать", "/admin/module_shop/update/" . $module->id)->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();