34 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			34 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| /**
 | |
|  * @var \Illuminate\Database\Eloquent\Collection $module
 | |
|  * @var int $page_number
 | |
|  */
 | |
| 
 | |
| use app\modules\module_shop\models\ModuleShop;
 | |
| use Itguild\EloquentTable\EloquentDataProvider;
 | |
| use Itguild\EloquentTable\ListEloquentTable;
 | |
| use kernel\IGTabel\action_column\DeleteActionColumn;
 | |
| use kernel\IGTabel\action_column\ViewActionColumn;
 | |
| use kernel\IGTabel\btn\PrimaryBtn;
 | |
| 
 | |
| $table = new ListEloquentTable(new EloquentDataProvider(\app\modules\module_shop\models\ModuleShop::class, [
 | |
|     'currentPage' => $page_number,
 | |
|     'perPage' => 8,
 | |
|     'params' => ["class" => "table table-bordered", "border" => "2"],
 | |
|     'baseUrl' => "/admin/module_shop",
 | |
| ]));
 | |
| 
 | |
| $table->columns([
 | |
|     'status' => function ($data) {
 | |
|         return ModuleShop::getStatus()[$data];
 | |
|     }
 | |
| ]);
 | |
| $table->beforePrint(function () {
 | |
|     $btn = PrimaryBtn::create("Добавить модуль", "/admin/module_shop/module/create", width: '200px')->fetch();
 | |
|     $btn .= PrimaryBtn::create("Добавить ядро", "/admin/module_shop/kernel/create", '400px')->fetch();
 | |
|     return $btn;
 | |
| });
 | |
| $table->addAction(ViewActionColumn::class);
 | |
| $table->addAction(DeleteActionColumn::class);
 | |
| $table->create();
 | |
| $table->render(); |