1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-14 07:02:34 +01:00
invoiceninja/app/Models/RecurringInvoiceInvitation.php

88 lines
1.7 KiB
PHP
Raw Normal View History

2019-04-24 02:22:02 +02:00
<?php
2019-05-11 05:32:07 +02:00
/**
* Invoice Ninja (https://invoiceninja.com).
2019-05-11 05:32:07 +02:00
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
2019-05-11 05:32:07 +02:00
*
2021-06-16 08:58:16 +02:00
* @license https://www.elastic.co/licensing/elastic-license
2019-05-11 05:32:07 +02:00
*/
2019-04-24 02:22:02 +02:00
namespace App\Models;
2020-10-05 13:32:56 +02:00
use App\Utils\Traits\Inviteable;
use App\Utils\Traits\MakesDates;
2020-10-28 11:10:49 +01:00
use Illuminate\Database\Eloquent\Relations\BelongsTo;
2020-10-05 13:32:56 +02:00
use Illuminate\Database\Eloquent\SoftDeletes;
2019-04-24 02:22:02 +02:00
class RecurringInvoiceInvitation extends BaseModel
{
2020-10-05 13:32:56 +02:00
use MakesDates;
use SoftDeletes;
use Inviteable;
2020-10-28 11:10:49 +01:00
2020-07-23 05:55:11 +02:00
protected $fillable = ['client_contact_id'];
protected $touches = ['recurring_invoice'];
protected $with = [
'company',
'contact',
];
2020-10-28 11:10:49 +01:00
public function getEntityType()
{
return self::class;
}
2020-10-05 23:46:47 +02:00
public function entityType()
{
return RecurringInvoice::class;
}
2019-04-24 02:22:02 +02:00
/**
* @return mixed
*/
public function recurring_invoice()
{
return $this->belongsTo(RecurringInvoice::class)->withTrashed();
}
/**
* @return mixed
*/
public function contact()
{
return $this->belongsTo(ClientContact::class, 'client_contact_id', 'id')->withTrashed();
2019-04-24 02:22:02 +02:00
}
/**
* @return mixed
*/
public function user()
{
return $this->belongsTo(User::class)->withTrashed();
}
/**
2020-10-28 11:10:49 +01:00
* @return BelongsTo
2019-04-24 02:22:02 +02:00
*/
public function company()
{
return $this->belongsTo(Company::class);
}
2020-10-19 12:59:58 +02:00
public function markViewed()
{
$this->viewed_date = now();
2020-10-19 12:59:58 +02:00
$this->save();
}
public function markOpened()
{
$this->opened_date = now();
2020-10-19 12:59:58 +02:00
$this->save();
}
2019-04-24 02:22:02 +02:00
}