export abstract
This commit is contained in:
@@ -2,22 +2,11 @@
|
||||
|
||||
namespace App\Exports\Common;
|
||||
|
||||
use App\Abstracts\Export;
|
||||
use App\Models\Common\Item as Model;
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Maatwebsite\Excel\Concerns\WithTitle;
|
||||
|
||||
class Items implements FromCollection, ShouldAutoSize, WithHeadings, WithMapping, WithTitle
|
||||
class Items extends Export
|
||||
{
|
||||
public $ids;
|
||||
|
||||
public function __construct($ids = null)
|
||||
{
|
||||
$this->ids = $ids;
|
||||
}
|
||||
|
||||
public function collection()
|
||||
{
|
||||
$model = Model::usingSearchString(request('search'));
|
||||
@@ -29,20 +18,7 @@ class Items implements FromCollection, ShouldAutoSize, WithHeadings, WithMapping
|
||||
return $model->get();
|
||||
}
|
||||
|
||||
public function map($model): array
|
||||
{
|
||||
return [
|
||||
$model->name,
|
||||
$model->description,
|
||||
$model->sale_price,
|
||||
$model->purchase_price,
|
||||
$model->category_id,
|
||||
$model->tax_id,
|
||||
$model->enabled,
|
||||
];
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
public function fields(): array
|
||||
{
|
||||
return [
|
||||
'name',
|
||||
@@ -54,9 +30,4 @@ class Items implements FromCollection, ShouldAutoSize, WithHeadings, WithMapping
|
||||
'enabled',
|
||||
];
|
||||
}
|
||||
|
||||
public function title(): string
|
||||
{
|
||||
return 'items';
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user