MicroFrameWork/app/modules/slider/views/view.php
2024-12-03 16:16:36 +03:00

29 lines
975 B
PHP

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