5 months ago

Call to undefined method

Posted 5 months ago by MarlonV

Hey all, i want to make a total sum by year with status payd.

What am i missing?

Payment model

    public function scopeTotalbillyear($query)
        return $query->whereYear('created_at', '=', date('Y'))->where('status', '=', ['payd']);

    public function getTotalPayd()
        $payments = Payment::Totalbillyear()->get();

        foreach($payments as $payment) {

            $sum+= $this->amount_payd;

        return $sum;

The error i get:

Call to undefined method App\Payment::TotalPrice()

Please sign in or create an account to participate in this conversation.