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

157 lines
5.5 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
*
2023-01-28 23:21:40 +01:00
* @copyright Copyright (c) 2023. 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
2023-03-08 08:33:42 +01:00
/**
* App\Models\RecurringInvoiceInvitation
*
* @property int $id
* @property int $company_id
* @property int $user_id
* @property int $client_contact_id
* @property int $recurring_invoice_id
* @property string $key
* @property int|null $created_at
* @property int|null $updated_at
* @property int|null $deleted_at
* @property string|null $transaction_reference
* @property string|null $message_id
* @property string|null $email_error
* @property string|null $signature_base64
* @property string|null $signature_date
* @property string|null $sent_date
* @property string|null $viewed_date
* @property string|null $opened_date
* @property string|null $email_status
2023-08-11 06:18:58 +02:00
* @property \App\Models\Company $company
* @property \App\Models\ClientContact $contact
* @property string $hashed_id
* @property \App\Models\RecurringInvoice $recurring_invoice
* @property \App\Models\User $user
2023-03-08 08:33:42 +01:00
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel company()
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel exclude($columns)
* @method static \Illuminate\Database\Eloquent\Builder|RecurringInvoiceInvitation newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|RecurringInvoiceInvitation newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|RecurringInvoiceInvitation onlyTrashed()
* @method static \Illuminate\Database\Eloquent\Builder|RecurringInvoiceInvitation query()
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel scope()
* @method static \Illuminate\Database\Eloquent\Builder|RecurringInvoiceInvitation whereClientContactId($value)
* @method static \Illuminate\Database\Eloquent\Builder|RecurringInvoiceInvitation whereCompanyId($value)
* @method static \Illuminate\Database\Eloquent\Builder|RecurringInvoiceInvitation whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|RecurringInvoiceInvitation whereDeletedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|RecurringInvoiceInvitation whereEmailError($value)
* @method static \Illuminate\Database\Eloquent\Builder|RecurringInvoiceInvitation whereEmailStatus($value)
* @method static \Illuminate\Database\Eloquent\Builder|RecurringInvoiceInvitation whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|RecurringInvoiceInvitation whereKey($value)
* @method static \Illuminate\Database\Eloquent\Builder|RecurringInvoiceInvitation whereMessageId($value)
* @method static \Illuminate\Database\Eloquent\Builder|RecurringInvoiceInvitation whereOpenedDate($value)
* @method static \Illuminate\Database\Eloquent\Builder|RecurringInvoiceInvitation whereRecurringInvoiceId($value)
* @method static \Illuminate\Database\Eloquent\Builder|RecurringInvoiceInvitation whereSentDate($value)
* @method static \Illuminate\Database\Eloquent\Builder|RecurringInvoiceInvitation whereSignatureBase64($value)
* @method static \Illuminate\Database\Eloquent\Builder|RecurringInvoiceInvitation whereSignatureDate($value)
* @method static \Illuminate\Database\Eloquent\Builder|RecurringInvoiceInvitation whereTransactionReference($value)
* @method static \Illuminate\Database\Eloquent\Builder|RecurringInvoiceInvitation whereUpdatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|RecurringInvoiceInvitation whereUserId($value)
* @method static \Illuminate\Database\Eloquent\Builder|RecurringInvoiceInvitation whereViewedDate($value)
* @method static \Illuminate\Database\Eloquent\Builder|RecurringInvoiceInvitation withTrashed()
* @method static \Illuminate\Database\Eloquent\Builder|RecurringInvoiceInvitation withoutTrashed()
* @mixin \Eloquent
*/
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;
}
2024-01-19 03:45:24 +01:00
public function getEntityString(): string
{
return 'recurring_invoice';
}
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();
}
2023-06-07 05:53:38 +02:00
/**
* @return mixed
*/
public function entity()
{
return $this->belongsTo(RecurringInvoice::class)->withTrashed();
}
2019-04-24 02:22:02 +02:00
/**
* @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
}