1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-21 00:41:34 +02:00
invoiceninja/app/Models/Payment.php

64 lines
1.3 KiB
PHP
Raw Normal View History

<?php
2019-05-11 05:32:07 +02:00
/**
* 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;
2019-05-03 09:57:55 +02:00
use App\Models\Filterable;
use App\Utils\Traits\MakesHash;
use Illuminate\Database\Eloquent\Model;
class Payment extends BaseModel
{
use MakesHash;
2019-05-03 09:57:55 +02:00
use Filterable;
2019-05-13 08:18:46 +02:00
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',
];
2019-05-03 09:57:55 +02:00
public function client()
{
return $this->belongsTo(Client::class);
}
2019-05-03 09:57:55 +02:00
public function company()
{
2019-05-03 09:57:55 +02:00
return $this->belongsTo(Company::class);
}
2019-05-03 09:57:55 +02:00
public function user()
{
2019-05-03 09:57:55 +02:00
return $this->belongsTo(User::class);
}
2019-04-28 07:31:32 +02:00
public function documents()
{
return $this->morphMany(Document::class, 'documentable');
}
2019-05-13 08:18:46 +02:00
public function invoices()
{
return $this->morphedByMany(Invoice::class, 'paymentable');
}
2019-05-15 07:03:18 +02:00
public function company_ledger()
{
return $this->morphMany(CompanyLedger::class, 'company_ledgerable');
}
}