mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Enabled importing products
This commit is contained in:
parent
42ac9507e5
commit
e6a05509b1
22
app/Ninja/Import/CSV/ProductTransformer.php
Normal file
22
app/Ninja/Import/CSV/ProductTransformer.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php namespace App\Ninja\Import\CSV;
|
||||
|
||||
use App\Ninja\Import\BaseTransformer;
|
||||
use League\Fractal\Resource\Item;
|
||||
|
||||
class ProductTransformer extends BaseTransformer
|
||||
{
|
||||
public function transform($data)
|
||||
{
|
||||
if (empty($data->product_key) || $this->hasProduct($data->product_key)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return new Item($data, function ($data) {
|
||||
return [
|
||||
'product_key' => $this->getString($data, 'product_key'),
|
||||
'notes' => $this->getString($data, 'notes'),
|
||||
'cost' => $this->getNumber($data, 'cost'),
|
||||
];
|
||||
});
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user