qcod / laravel-gamify

Gamify your Laravel app with Reputation Points & Achievements Badges support

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

belongsTomany?

AO-IO opened this issue · comments

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?