6 changed files with 33 additions and 66 deletions
-
59app/AdminSupplier/Actions/Grid/ExportToExcelButton.php
-
5app/AdminSupplier/Controllers/ProductController.php
-
4app/AdminSupplier/Controllers/ProductExportLogController.php
-
12app/AdminSupplier/Extensions/ProductToExcelExporter.php
-
10app/Exports/ProductExport.php
-
7app/Jobs/ExportProductToExcel.php
@ -1,59 +0,0 @@ |
|||
<?php |
|||
|
|||
namespace App\AdminSupplier\Actions\Grid; |
|||
|
|||
use App\Jobs\ExportProductToExcel; |
|||
use Dcat\Admin\Grid\Tools\AbstractTool; |
|||
use Dcat\Admin\Traits\HasPermissions; |
|||
use Illuminate\Contracts\Auth\Authenticatable; |
|||
use Illuminate\Database\Eloquent\Model; |
|||
use Illuminate\Http\Request; |
|||
|
|||
class ExportToExcelButton extends AbstractTool |
|||
{ |
|||
/** |
|||
* @return string |
|||
*/ |
|||
protected $title = '导入所有产品到excel'; |
|||
|
|||
public function html() |
|||
{ |
|||
$this->appendHtmlAttribute('class', 'btn btn-primary btn-outline'); |
|||
|
|||
return <<<HTML |
|||
<button {$this->formatHtmlAttributes()}>{$this->title()}</button> |
|||
HTML; |
|||
} |
|||
|
|||
public function handle(Request $request) |
|||
{ |
|||
ExportProductToExcel::dispatch(\Admin::user()->id); |
|||
return $this->response()->success('导出成功,稍后到导出列表下载')->redirect(admin_url('product/export')); |
|||
} |
|||
|
|||
/** |
|||
* @return string|array|void |
|||
*/ |
|||
public function confirm() |
|||
{ |
|||
// return ['Confirm?', 'contents'];
|
|||
} |
|||
|
|||
/** |
|||
* @param Model|Authenticatable|HasPermissions|null $user |
|||
* |
|||
* @return bool |
|||
*/ |
|||
protected function authorize($user): bool |
|||
{ |
|||
return true; |
|||
} |
|||
|
|||
/** |
|||
* @return array |
|||
*/ |
|||
protected function parameters() |
|||
{ |
|||
return []; |
|||
} |
|||
} |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue