Fix member id
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
This commit is contained in:
parent
f5a57a9d16
commit
8b76f59804
|
|
@ -43,7 +43,7 @@ class MassStoreAction
|
||||||
|
|
||||||
$invoice = Invoice::createFromFactory($factory);
|
$invoice = Invoice::createFromFactory($factory);
|
||||||
$invoice->save();
|
$invoice->save();
|
||||||
$invoice->positions()->createMany($invoice->positions->toArray());
|
$invoice->positions()->createMany($invoice->positions);
|
||||||
$invoices->push($invoice->fresh('positions'));
|
$invoices->push($invoice->fresh('positions'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ class MemberNewInvoiceAction
|
||||||
return [
|
return [
|
||||||
...$invoice->getAttributes(),
|
...$invoice->getAttributes(),
|
||||||
'to' => $invoice->to,
|
'to' => $invoice->to,
|
||||||
'positions' => $invoice->getRelationValue('positions')->toArray(),
|
'positions' => $invoice->getRelationValue('positions'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
namespace App\Invoice\Data;
|
namespace App\Invoice\Data;
|
||||||
|
|
||||||
|
use Spatie\LaravelData\Attributes\MapOutputName;
|
||||||
use Spatie\LaravelData\Data;
|
use Spatie\LaravelData\Data;
|
||||||
|
|
||||||
class PositionData extends Data
|
class PositionData extends Data
|
||||||
|
|
@ -9,6 +10,7 @@ class PositionData extends Data
|
||||||
public function __construct(
|
public function __construct(
|
||||||
public string $description,
|
public string $description,
|
||||||
public string $price,
|
public string $price,
|
||||||
|
#[MapOutputName('member_id')]
|
||||||
public int $memberId,
|
public int $memberId,
|
||||||
) {}
|
) {}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -81,8 +81,7 @@ class MemberInvoiceFactory implements InvoiceCreator
|
||||||
$positions->push(PositionData::from([
|
$positions->push(PositionData::from([
|
||||||
'description' => str($child->name)->replace('{name}', $member->firstname . ' ' . $member->lastname)->replace('{year}', (string) $this->year),
|
'description' => str($child->name)->replace('{name}', $member->firstname . ' ' . $member->lastname)->replace('{year}', (string) $this->year),
|
||||||
'price' => $child->amount,
|
'price' => $child->amount,
|
||||||
/** @todo check if this is correct */
|
'memberId' => $member->id,
|
||||||
'member_id' => $member->id,
|
|
||||||
'id' => null,
|
'id' => null,
|
||||||
]));
|
]));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue