2024-09-23 15:33:48 +03:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @var \Illuminate\Database\Eloquent\Collection $options
|
|
|
|
* @var int $page_number
|
|
|
|
*/
|
|
|
|
|
|
|
|
use Itguild\EloquentTable\EloquentDataProvider;
|
|
|
|
use Itguild\EloquentTable\ListEloquentTable;
|
2024-10-17 14:55:00 +03:00
|
|
|
use kernel\IGTabel\action_column\DeleteActionColumn;
|
|
|
|
use kernel\IGTabel\action_column\EditActionColumn;
|
|
|
|
use kernel\IGTabel\action_column\ViewActionColumn;
|
2024-09-23 15:33:48 +03:00
|
|
|
use kernel\IGTabel\btn\PrimaryBtn;
|
|
|
|
use kernel\modules\option\models\Option;
|
2024-11-20 12:45:02 +03:00
|
|
|
use kernel\widgets\IconBtn\IconBtnCreateWidget;
|
|
|
|
use kernel\widgets\IconBtn\IconBtnDeleteWidget;
|
|
|
|
use kernel\widgets\IconBtn\IconBtnEditWidget;
|
|
|
|
use kernel\widgets\IconBtn\IconBtnViewWidget;
|
2024-09-23 15:33:48 +03:00
|
|
|
|
|
|
|
$table = new ListEloquentTable(new EloquentDataProvider(Option::class, [
|
|
|
|
'current_page' => $page_number,
|
|
|
|
'per_page' => 5,
|
|
|
|
'params' => ["class" => "table table-bordered", "border" => "2"],
|
|
|
|
'baseUrl' => "/admin/option",
|
|
|
|
]));
|
|
|
|
|
|
|
|
$table->beforePrint(function () {
|
2024-11-20 12:45:02 +03:00
|
|
|
return IconBtnCreateWidget::create(['url' => '/admin/option/create'])->run();
|
2024-09-23 15:33:48 +03:00
|
|
|
});
|
|
|
|
|
2024-09-24 14:57:25 +03:00
|
|
|
$table->columns([
|
|
|
|
"status" => [
|
|
|
|
"value" => function ($cell) {
|
|
|
|
return Option::getStatus()[$cell];
|
|
|
|
}]
|
|
|
|
]);
|
|
|
|
|
2024-11-20 12:45:02 +03:00
|
|
|
$table->addAction(function($row) {
|
|
|
|
return IconBtnViewWidget::create(['url' => '/admin/option/view/' . $row['id']])->run();
|
|
|
|
});
|
|
|
|
$table->addAction(function($row) {
|
|
|
|
return IconBtnEditWidget::create(['url' => '/admin/option/update/' . $row['id']])->run();
|
|
|
|
});
|
|
|
|
$table->addAction(function($row) {
|
|
|
|
return IconBtnDeleteWidget::create(['url' => '/admin/option/delete/' . $row['id']])->run();
|
|
|
|
});
|
|
|
|
|
2024-09-23 15:33:48 +03:00
|
|
|
$table->create();
|
|
|
|
$table->render();
|