29 lines
1.0 KiB
PHP
29 lines
1.0 KiB
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 = \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();
|
|
return $btn;
|
|
});
|
|
$table->rows([
|
|
'status' => (function ($data) {
|
|
return \kernel\app_modules\slider\models\Slider::getStatus()[$data];
|
|
})
|
|
]);
|
|
$table->create();
|
|
$table->render(); |