34 lines
632 B
PHP
Raw Normal View History

<?php
namespace App\Exports\Common\Sheets;
use App\Abstracts\Export;
use App\Models\Common\Item as Model;
2020-12-21 11:22:15 +03:00
class Items extends Export
{
public function collection()
{
2021-06-27 11:40:46 +03:00
return Model::with('category')->collectForExport($this->ids);
}
public function map($model): array
{
$model->category_name = $model->category->name;
return parent::map($model);
}
public function fields(): array
{
return [
'name',
'description',
'sale_price',
'purchase_price',
'category_name',
'enabled',
];
}
}