45 lines
1009 B
PHP
45 lines
1009 B
PHP
<?php
|
|
|
|
namespace App\Admin\Actions\Grid;
|
|
|
|
use App\Admin\Forms\SkuGift as SkuGiftForm;
|
|
use Dcat\Admin\Grid\RowAction;
|
|
use Dcat\Admin\Widgets\Modal;
|
|
|
|
class SkuGift extends RowAction
|
|
{
|
|
/**
|
|
* @return string
|
|
*/
|
|
protected $title = '<i class="feather icon-list grid-action-icon"></i>';
|
|
|
|
public function title()
|
|
{
|
|
if ($this->title) {
|
|
return $this->title.' '.__('admin_message.actions.grid.sku_gift');
|
|
}
|
|
|
|
return __('admin_message.actions.grid.sku_gift');
|
|
}
|
|
|
|
/**
|
|
* @param Model|Authenticatable|HasPermissions|null $user
|
|
*
|
|
* @return bool
|
|
*/
|
|
protected function authorize($user): bool
|
|
{
|
|
return $user->can('dcat.admin.product_skus.sku_gift');
|
|
}
|
|
|
|
public function render()
|
|
{
|
|
$form = SkuGiftForm::make()->payload(['id'=>$this->getKey()]);
|
|
return Modal::make()
|
|
->lg()
|
|
->title($this->title())
|
|
->body($form)
|
|
->button($this->title());
|
|
}
|
|
}
|