MicroFrameWork/kernel/modules/option/views/view.php

29 lines
976 B
PHP
Raw Normal View History

2024-09-23 15:33:48 +03:00
<?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;
});
2024-10-08 17:06:14 +03:00
$table->rows([
'status' => (function ($data) {
return \kernel\modules\option\models\Option::getStatus()[$data];
})
]);
2024-09-23 15:33:48 +03:00
$table->create();
$table->render();