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\Sales;
use App\Abstracts\Export;
use App\Models\Common\Contact 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 Customers implements FromCollection, ShouldAutoSize, WithHeadings, WithMapping, WithTitle
class Customers extends Export
{
public $ids;
public function __construct($ids = null)
{
$this->ids = $ids;
}
public function collection()
{
$model = Model::type('customer')->usingSearchString(request('search'));
@@ -29,23 +18,7 @@ class Customers implements FromCollection, ShouldAutoSize, WithHeadings, WithMap
return $model->get();
}
public function map($model): array
{
return [
$model->name,
$model->email,
$model->tax_number,
$model->phone,
$model->address,
$model->website,
$model->currency_code,
$model->reference,
$model->enabled,
$model->user_id,
];
}
public function headings(): array
public function fields(): array
{
return [
'name',
@@ -60,9 +33,4 @@ class Customers implements FromCollection, ShouldAutoSize, WithHeadings, WithMap
'user_id',
];
}
public function title(): string
{
return 'customers';
}
}