1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 16:31:33 +02:00
invoiceninja/app/Models/Invoice.php

57 lines
1015 B
PHP
Raw Normal View History

<?php
namespace App\Models;
2019-04-04 03:38:17 +02:00
use App\Models\Filterable;
use App\Utils\Traits\MakesHash;
use Illuminate\Database\Eloquent\Model;
2019-04-04 03:38:17 +02:00
use Illuminate\Database\Eloquent\SoftDeletes;
class Invoice extends BaseModel
{
use MakesHash;
2019-04-04 03:38:17 +02:00
use SoftDeletes;
use Filterable;
protected $guarded = [
'id',
];
protected $casts = [
'settings' => 'object'
];
2019-04-25 09:16:41 +02:00
protected $with = [
'company'
];
2019-04-04 01:30:49 +02:00
const STATUS_DRAFT = 1;
const STATUS_SENT = 2;
const STATUS_PARTIAL = 5;
const STATUS_PAID = 6;
2019-04-23 06:16:41 +02:00
const STATUS_REVERSED = 7; //new for V2
2019-04-04 01:30:49 +02:00
const STATUS_OVERDUE = -1;
const STATUS_UNPAID = -2;
2019-04-04 01:17:15 +02:00
public function company()
{
2019-04-04 01:17:15 +02:00
return $this->belongsTo(Company::class);
}
2019-04-04 01:17:15 +02:00
public function user()
{
2019-04-04 01:17:15 +02:00
return $this->belongsTo(User::class);
}
2019-04-04 01:30:49 +02:00
public function invitations()
{
2019-04-24 02:22:02 +02:00
return $this->hasMany(InvoiceInvitation::class);
}
public function client()
{
return $this->belongsTo(Client::class);
}
}