export abstract
This commit is contained in:
@@ -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';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user