MicroFrameWork/kernel/app_modules/photo/views/index.php

41 lines
1.3 KiB
PHP
Raw Normal View History

2024-11-29 13:23:48 +03:00
<?php
/**
* @var int $page_number
*/
use Itguild\EloquentTable\EloquentDataProvider;
use Itguild\EloquentTable\ListEloquentTable;
use kernel\app_modules\photo\models\Photo;
use kernel\widgets\IconBtn\IconBtnCreateWidget;
use kernel\widgets\IconBtn\IconBtnDeleteWidget;
use kernel\widgets\IconBtn\IconBtnEditWidget;
use kernel\widgets\IconBtn\IconBtnViewWidget;
$table = new ListEloquentTable(new EloquentDataProvider(Photo::class, [
'currentPage' => $page_number,
'perPage' => 8,
'params' => ["class" => "table table-bordered", "border" => "2"],
'baseUrl' => "/admin/photo",
]));
//$table->beforePrint(function () {
// return IconBtnCreateWidget::create(['url' => '/admin/photo/create'])->run();
//});
$table->columns([
'image' => function ($data) {
return $data ? "<img src='$data' width='150px'>" : "";
}
]);
$table->addAction(function($row) {
return IconBtnViewWidget::create(['url' => '/admin/photo/view/' . $row['id']])->run();
});
//$table->addAction(function($row) {
// return IconBtnEditWidget::create(['url' => '/admin/photo/update/' . $row['id']])->run();
//});
//$table->addAction(function($row) {
// return IconBtnDeleteWidget::create(['url' => '/admin/photo/delete/' . $row['id']])->run();
//});
$table->create();
$table->render();