42 lines
1001 B
PHP
42 lines
1001 B
PHP
<?php
|
|
|
|
namespace App\Admin\Actions\Show;
|
|
|
|
use App\Admin\Forms\DrawActivityPublish as DrawActivityPublishForm;
|
|
use Dcat\Admin\Show\AbstractTool;
|
|
use Dcat\Admin\Widgets\Modal;
|
|
|
|
class DrawActivityPublish extends AbstractTool
|
|
{
|
|
/**
|
|
* @return string
|
|
*/
|
|
protected $title = '<i class="feather icon-navigation"></i> 发布';
|
|
|
|
/**
|
|
* @var string
|
|
*/
|
|
protected $style = 'btn-danger';
|
|
|
|
/**
|
|
* @param Model|Authenticatable|HasPermissions|null $user
|
|
*
|
|
* @return bool
|
|
*/
|
|
protected function authorize($user): bool
|
|
{
|
|
return $user->can('dcat.admin.draw_activities.publish');
|
|
}
|
|
|
|
public function render()
|
|
{
|
|
$form = DrawActivityPublishForm::make()->payload(['id'=>$this->getKey()]);
|
|
|
|
return Modal::make()
|
|
->lg()
|
|
->title($this->title())
|
|
->body($form)
|
|
->button("<a href=\"javascript:void(0)\" class=\"btn btn-sm {$this->style}\">{$this->title}</a> ");
|
|
}
|
|
}
|