2020-01-20 02:05:40 +03:00

34 lines
623 B
PHP

<?php
namespace App\Exports\Common;
use App\Abstracts\Export;
use App\Models\Common\Item as Model;
class Items extends Export
{
public function collection()
{
$model = Model::usingSearchString(request('search'));
if (!empty($this->ids)) {
$model->whereIn('id', (array) $this->ids);
}
return $model->get();
}
public function fields(): array
{
return [
'name',
'description',
'sale_price',
'purchase_price',
'category_id',
'tax_id',
'enabled',
];
}
}