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

32 lines
1.1 KiB
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;
2024-11-20 12:45:02 +03:00
use kernel\widgets\IconBtn\IconBtnDeleteWidget;
use kernel\widgets\IconBtn\IconBtnEditWidget;
use kernel\widgets\IconBtn\IconBtnListWidget;
2024-09-23 15:33:48 +03:00
$table = new ViewEloquentTable(new ViewJsonTableEloquentModel($option, [
'params' => ["class" => "table table-bordered", "border" => "2"],
'baseUrl' => "/admin/user",
]));
$table->beforePrint(function () use ($option) {
2024-11-20 12:45:02 +03:00
$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();
2024-09-23 15:33:48 +03:00
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();