Project.php 398 Bytes
Newer Older
beardedwarrior's avatar
beardedwarrior committed
1 2 3 4 5 6 7 8 9 10 11 12 13
<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Project extends Model
{
    /**
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
     */
    public function deposits()
    {
14
        return $this->hasMany(Deposit::class, 'payment_id', 'payment_id');
beardedwarrior's avatar
beardedwarrior committed
15
    }
16 17 18 19

    public function getAmountReceivedAttribute() {
        return $this->deposits->sum('amount');
    }
beardedwarrior's avatar
beardedwarrior committed
20
}