36 lines
782 B
PHP
36 lines
782 B
PHP
<?php
|
|
|
|
namespace App\Imports\Sales;
|
|
|
|
use App\Abstracts\Import;
|
|
use App\Models\Banking\Transaction as Model;
|
|
use App\Http\Requests\Banking\Transaction as Request;
|
|
use Jenssegers\Date\Date;
|
|
|
|
class Revenues extends Import
|
|
{
|
|
public function model(array $row)
|
|
{
|
|
return new Model($row);
|
|
}
|
|
|
|
public function map($row): array
|
|
{
|
|
$row['company_id'] = session('company_id');
|
|
$row['type'] = 'income';
|
|
$row['paid_at'] = Date::parse($row['paid_at'])->format('Y-m-d H:i:s');
|
|
|
|
// Make reconciled field integer
|
|
if (isset($row['reconciled'])) {
|
|
$row['reconciled'] = (int) $row['reconciled'];
|
|
}
|
|
|
|
return $row;
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
return (new Request())->rules();
|
|
}
|
|
}
|