27 lines
782 B
PHP
27 lines
782 B
PHP
<?php
|
|
|
|
namespace App\Admin\Renderable;
|
|
|
|
use App\Models\LuckDrawOption;
|
|
use Dcat\Admin\Grid;
|
|
use Dcat\Admin\Grid\LazyRenderable;
|
|
|
|
class LuckDrawTable extends LazyRenderable
|
|
{
|
|
public function grid(): Grid
|
|
{
|
|
return Grid::make(new LuckDrawOption(), function (Grid $grid) {
|
|
$grid->model()->where('activity_id', $this->key);
|
|
$grid->column('id');
|
|
$grid->column('draw_name', '奖品名称');
|
|
$grid->column('draw_rate', '中奖概率');
|
|
$grid->column('draw_num', '奖品数量')->display(function(){
|
|
return $this->is_num ? $this->draw_num:'不限量';
|
|
});
|
|
|
|
$grid->paginate(10);
|
|
$grid->disableRowSelector();
|
|
$grid->disableActions();
|
|
});
|
|
}
|
|
} |