1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-05 18:52:44 +01:00
invoiceninja/app/Models/Payment.php
2019-05-15 15:03:18 +10:00

64 lines
1.3 KiB
PHP

<?php
/**
* Invoice Ninja (https://invoiceninja.com)
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2019. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace App\Models;
use App\Models\Filterable;
use App\Utils\Traits\MakesHash;
use Illuminate\Database\Eloquent\Model;
class Payment extends BaseModel
{
use MakesHash;
use Filterable;
const STATUS_PENDING = 1;
const STATUS_VOIDED = 2;
const STATUS_FAILED = 3;
const STATUS_COMPLETED = 4;
const STATUS_PARTIALLY_REFUNDED = 5;
const STATUS_REFUNDED = 6;
protected $guarded = [
'id',
];
public function client()
{
return $this->belongsTo(Client::class);
}
public function company()
{
return $this->belongsTo(Company::class);
}
public function user()
{
return $this->belongsTo(User::class);
}
public function documents()
{
return $this->morphMany(Document::class, 'documentable');
}
public function invoices()
{
return $this->morphedByMany(Invoice::class, 'paymentable');
}
public function company_ledger()
{
return $this->morphMany(CompanyLedger::class, 'company_ledgerable');
}
}