export abstract

This commit is contained in:
denisdulici
2020-01-20 02:05:40 +03:00
parent 88dade86b6
commit 569f6c314f
19 changed files with 129 additions and 628 deletions

View File

@@ -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';
}
}