MicroFrameWork/kernel/modules/option/views/view.php
2024-11-20 12:45:02 +03:00

32 lines
1.1 KiB
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;
use kernel\widgets\IconBtn\IconBtnDeleteWidget;
use kernel\widgets\IconBtn\IconBtnEditWidget;
use kernel\widgets\IconBtn\IconBtnListWidget;
$table = new ViewEloquentTable(new ViewJsonTableEloquentModel($option, [
'params' => ["class" => "table table-bordered", "border" => "2"],
'baseUrl' => "/admin/user",
]));
$table->beforePrint(function () use ($option) {
$btn = IconBtnListWidget::create(['url' => '/admin/option'])->run();
$btn .= IconBtnEditWidget::create(['url' => '/admin/option/update/' . $option->id])->run();
$btn .= IconBtnDeleteWidget::create(['url' => '/admin/option/delete/' . $option->id])->run();
return $btn;
});
$table->rows([
'status' => (function ($data) {
return \kernel\modules\option\models\Option::getStatus()[$data];
})
]);
$table->create();
$table->render();