39 lines
1.3 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;
});
2024-12-10 11:56:33 +03:00
$entityRelation = new \kernel\EntityRelation();
$additionals = $entityRelation->getEntityAdditionalProperty("slider", $slider);
foreach ($additionals as $key => $additional) {
$table->addRow($key, function () use ($additional) {
return $additional;
}, ['after' => 'status']);
}
2024-12-03 16:16:36 +03:00
$table->rows([
'status' => (function ($data) {
2024-12-09 16:26:12 +03:00
return \kernel\app_modules\slider\models\Slider::getStatus()[$data];
2024-12-03 16:16:36 +03:00
})
]);
$table->create();
$table->render();