mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-14 07:02:34 +01:00
68 lines
1.4 KiB
PHP
68 lines
1.4 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 $fillable = [
|
|
'client_id',
|
|
'payment_type_id',
|
|
'amount',
|
|
'payment_date',
|
|
'transaction_reference'
|
|
];
|
|
|
|
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');
|
|
}
|
|
}
|