backend/kernel/modules/slider/views/view.php

29 lines
1.0 KiB
PHP
Raw Normal View History

2024-12-03 16:16:36 +03:00
<?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) {
2024-12-09 12:57:12 +03:00
$btn = \kernel\widgets\IconBtn\IconBtnListWidget::create(['url' => "/admin/slider"])->run();
$btn .= \kernel\widgets\IconBtn\IconBtnEditWidget::create(['url' => "/admin/slider/update/" . $slider->id])->run();
$btn .= \kernel\widgets\IconBtn\IconBtnDeleteWidget::create(['url' => "/admin/slider/delete/" . $slider->id])->run();
2024-12-03 16:16:36 +03:00
return $btn;
});
$table->rows([
'status' => (function ($data) {
2024-12-09 12:57:12 +03:00
return \kernel\modules\slider\models\Slider::getStatus()[$data];
2024-12-03 16:16:36 +03:00
})
]);
$table->create();
$table->render();