belongsTomany?
AO-IO opened this issue · 0 comments
AO-IO commented
I'm trying to give points to the user when attaching invoice:
$in = $user->invoices()->attach($request->invoice);
$user->givePoint(new InvoicePoint($in));
I'm getting an error Initialize $subject field in constructor.
relation in User
Model :
public function invoices()
{
return $this->belongsToMany(Invoice::class, 'invoice_user');
}
Am I doing something wrong?