MicroFrameWork/kernel/modules/option/views/view.php
2024-10-08 17:06:14 +03:00

29 lines
976 B
PHP

<?php
/**
* @var \Illuminate\Database\Eloquent\Collection $option
*/
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($option, [
'params' => ["class" => "table table-bordered", "border" => "2"],
'baseUrl' => "/admin/user",
]));
$table->beforePrint(function () use ($option) {
$btn = PrimaryBtn::create("Список", "/admin/option")->fetch();
$btn .= SuccessBtn::create("Редактировать", "/admin/option/update/" . $option->id)->fetch();
$btn .= DangerBtn::create("Удалить", "/admin/option/delete/" . $option->id)->fetch();
return $btn;
});
$table->rows([
'status' => (function ($data) {
return \kernel\modules\option\models\Option::getStatus()[$data];
})
]);
$table->create();
$table->render();