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;
|
|
|
|
use kernel\IGTabel\btn\PrimaryBtn;
|
|
|
|
use kernel\modules\option\models\Option;
|
|
|
|
use kernel\modules\option\table\columns\OptionDeleteActionColumn;
|
|
|
|
use kernel\modules\option\table\columns\OptionEditActionColumn;
|
|
|
|
use kernel\modules\option\table\columns\OptionViewActionColumn;
|
|
|
|
|
|
|
|
$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 () {
|
|
|
|
return PrimaryBtn::create("Создать", "/admin/option/create")->fetch();
|
|
|
|
//return (new PrimaryBtn("Создать", "/admin/user/create"))->fetch();
|
|
|
|
});
|
|
|
|
|
2024-09-24 14:57:25 +03:00
|
|
|
$table->columns([
|
|
|
|
"status" => [
|
|
|
|
"value" => function ($cell) {
|
|
|
|
return Option::getStatus()[$cell];
|
|
|
|
}]
|
|
|
|
]);
|
|
|
|
|
2024-09-23 15:33:48 +03:00
|
|
|
$table->addAction(OptionViewActionColumn::class);
|
|
|
|
$table->addAction(OptionEditActionColumn::class);
|
|
|
|
$table->addAction(OptionDeleteActionColumn::class);
|
|
|
|
$table->create();
|
|
|
|
$table->render();
|