setTitle("Список существующих диалогов"); $table = new ListEloquentTable(new EloquentDataProvider(\kernel\app_modules\tgbot\models\TgbotNotification::query()->orderBy("id", "DESC"), [ 'currentPage' => $page_number, 'perPage' => 8, 'params' => ["class" => "table table-bordered", "border" => "2"], 'baseUrl' => "/admin/tg-bot-notification", 'searchPrefix' => "", 'searchParams' => (new \kernel\Request())->get(), ])); $table->beforePrint(function () { return PrimaryBtn::create("Создать", "/admin/tg-bot-notification/create")->fetch(); }); $table->columns([ "status" => [ "value" => function ($cell) { return \kernel\app_modules\tgbot\models\TgbotNotification::getStatus()[$cell] ?? 0; } ], "bot_id" => [ "filter" => [ "class" => \Itguild\Tables\Filter\InputTextFilter::class ] ], "dialog_id" => [ "filter" => [ "class" => \Itguild\Tables\Filter\InputTextFilter::class ] ] ]); $table->addAction(function($row) { return IconBtnViewWidget::create(['url' => '/admin/tg-bot-notification/' . $row['id']])->run(); }); $table->addAction(function($row) { return IconBtnEditWidget::create(['url' => '/admin/tg-bot-notification/update/' . $row['id']])->run(); }); $table->addAction(function($row) { return IconBtnDeleteWidget::create(['url' => '/admin/tg-bot-notification/delete/' . $row['id']])->run(); }); $table->create(); $table->render();