58 lines
1.1 KiB
PHP
58 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Admin\Extensions\Grid\Tools;
|
|
|
|
use App\Admin\Forms\DrawActivityTicketChange as DrawActivityTicketChangeForm;
|
|
use App\Models\DrawActivity;
|
|
use Dcat\Admin\Grid\Tools\AbstractTool;
|
|
use Dcat\Admin\Widgets\Modal;
|
|
|
|
class DrawActivityTicketChange extends AbstractTool
|
|
{
|
|
protected $style = 'btn btn-primary';
|
|
|
|
public function __construct(
|
|
private DrawActivity $drawActivity,
|
|
) {
|
|
}
|
|
|
|
protected function authorize($user): bool
|
|
{
|
|
return $user->can('dcat.admin.draw_activities.change_tickets');
|
|
}
|
|
|
|
/**
|
|
* 按钮文本
|
|
*
|
|
* @return string|void
|
|
*/
|
|
public function title()
|
|
{
|
|
return '增加/扣除';
|
|
}
|
|
|
|
public function render()
|
|
{
|
|
$form = DrawActivityTicketChangeForm::make();
|
|
$form->payload(['id' => $this->drawActivity->id]);
|
|
|
|
return Modal::make()
|
|
->lg()
|
|
->title($this->title())
|
|
->body($form)
|
|
->button($this->html());
|
|
}
|
|
|
|
/**
|
|
* 设置请求参数
|
|
*
|
|
* @return array|void
|
|
*/
|
|
public function parameters()
|
|
{
|
|
return [
|
|
|
|
];
|
|
}
|
|
}
|