41 lines
1.0 KiB
PHP
41 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Admin\Actions\Grid;
|
|
|
|
use App\Admin\Forms\DealerEditProduct as DealerEditProductForm;
|
|
use App\Admin\Renderable\DealerUserProductSimpleTable;
|
|
use Dcat\Admin\Grid\RowAction;
|
|
use Dcat\Admin\Widgets\Modal;
|
|
|
|
class DealerEditProduct extends RowAction
|
|
{
|
|
public function title()
|
|
{
|
|
if ($this->title) {
|
|
return $this->title;
|
|
}
|
|
return '<i class="feather grid-action-icon icon-package"></i> 修改库存 ';
|
|
}
|
|
|
|
/**
|
|
* @param Model|Authenticatable|HasPermissions|null $user
|
|
*
|
|
* @return bool
|
|
*/
|
|
protected function authorize($user): bool
|
|
{
|
|
return $user->can('dcat.admin.dealers.edit_product');
|
|
}
|
|
|
|
public function render()
|
|
{
|
|
$form = DealerEditProductForm::make()->payload(['id'=>$this->primaryKey]);
|
|
// $grid = DealerUserProductSimpleTable::make(['id'=>$this->primaryKey]);
|
|
return Modal::make()
|
|
->lg()
|
|
->title($this->title())
|
|
->body($form)
|
|
->button($this->title());
|
|
}
|
|
}
|