invoiceninja/app/Models/Invoice.php

43 lines
797 B
PHP
Raw Normal View History

<?php
namespace App\Models;
2019-04-04 12:38:17 +11:00
use App\Models\Filterable;
use App\Utils\Traits\MakesHash;
use Illuminate\Database\Eloquent\Model;
2019-04-04 12:38:17 +11:00
use Illuminate\Database\Eloquent\SoftDeletes;
class Invoice extends BaseModel
{
use MakesHash;
2019-04-04 12:38:17 +11:00
use SoftDeletes;
use Filterable;
protected $guarded = [
'id',
];
2019-04-04 10:30:49 +11:00
const STATUS_DRAFT = 1;
const STATUS_SENT = 2;
const STATUS_VIEWED = 3;
const STATUS_PARTIAL = 5;
const STATUS_PAID = 6;
const STATUS_OVERDUE = -1;
const STATUS_UNPAID = -2;
2019-04-04 10:17:15 +11:00
public function company()
{
2019-04-04 10:17:15 +11:00
return $this->belongsTo(Company::class);
}
2019-04-04 10:17:15 +11:00
public function user()
{
2019-04-04 10:17:15 +11:00
return $this->belongsTo(User::class);
}
2019-04-04 10:30:49 +11:00
public function invitations()
{
$this->morphMany(Invitation::class, 'inviteable');
}
}