27 lines
724 B
PHP
27 lines
724 B
PHP
<?php
|
|
|
|
namespace Peidikeji\User\Action;
|
|
|
|
use Dcat\Admin\Show\AbstractTool;
|
|
use Dcat\Admin\Widgets\Modal;
|
|
use Peidikeji\User\Form\BalanceForm;
|
|
|
|
class ShowBalance extends AbstractTool
|
|
{
|
|
protected $style = 'btn btn-sm btn-danger';
|
|
|
|
protected $title = '变更余额';
|
|
|
|
protected function html()
|
|
{
|
|
$model = $this->parent->model();
|
|
$form = BalanceForm::make()->payload(['balance' => $model->balance, 'id' => $model->id]);
|
|
return Modal::make()->lg()->title($this->title)->body($form)->button('<button type="button" class="'.$this->style.'">'.$this->title.'</button>');
|
|
}
|
|
|
|
protected function authorize($user): bool
|
|
{
|
|
return $user->can('dcat.admin.users.balance');
|
|
}
|
|
}
|