2018-10-15 14:40:34 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
2019-04-04 03:38:17 +02:00
|
|
|
use App\Models\Filterable;
|
2018-11-20 05:36:56 +01:00
|
|
|
use App\Utils\Traits\MakesHash;
|
2018-10-15 14:40:34 +02:00
|
|
|
use Illuminate\Database\Eloquent\Model;
|
2019-04-04 03:38:17 +02:00
|
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
2018-10-15 14:40:34 +02:00
|
|
|
|
2018-11-02 11:54:46 +01:00
|
|
|
class Invoice extends BaseModel
|
2018-10-15 14:40:34 +02:00
|
|
|
{
|
2018-11-20 05:36:56 +01:00
|
|
|
use MakesHash;
|
2019-04-04 03:38:17 +02:00
|
|
|
use SoftDeletes;
|
|
|
|
use Filterable;
|
|
|
|
|
2018-11-20 05:36:56 +01:00
|
|
|
protected $guarded = [
|
|
|
|
'id',
|
|
|
|
];
|
|
|
|
|
2019-04-17 08:20:32 +02:00
|
|
|
protected $casts = [
|
|
|
|
'settings' => 'object'
|
|
|
|
];
|
|
|
|
|
2019-04-04 01:30:49 +02: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 01:17:15 +02:00
|
|
|
public function company()
|
2018-11-20 05:36:56 +01:00
|
|
|
{
|
2019-04-04 01:17:15 +02:00
|
|
|
return $this->belongsTo(Company::class);
|
2018-11-20 05:36:56 +01:00
|
|
|
}
|
|
|
|
|
2019-04-04 01:17:15 +02:00
|
|
|
public function user()
|
2018-11-20 05:36:56 +01:00
|
|
|
{
|
2019-04-04 01:17:15 +02:00
|
|
|
return $this->belongsTo(User::class);
|
2018-11-20 05:36:56 +01:00
|
|
|
}
|
2019-04-04 01:30:49 +02:00
|
|
|
|
2018-10-22 14:04:37 +02:00
|
|
|
public function invitations()
|
|
|
|
{
|
|
|
|
$this->morphMany(Invitation::class, 'inviteable');
|
|
|
|
}
|
2018-10-15 14:40:34 +02:00
|
|
|
}
|