Level 67
You don't really need to reference this in this way... I suppose it is possible... but to create a receipt, you'd just pass it the payment_id.
$user = Auth::user();
$payment = Payment::create('description' => 'Paid for service');
Receipt::create(['payment_id' => $payment->id, 'amount' => 300]);
The receipt has a relationship to payment... payment to user.
Each thing should exist in a cascade anyway.
24 likes