1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-14 15:13:29 +01:00
invoiceninja/app/Models/License.php

77 lines
3.0 KiB
PHP
Raw Normal View History

2023-03-09 13:29:44 +01:00
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
2024-04-12 06:15:41 +02:00
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
2023-03-09 13:29:44 +01:00
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\Models;
use Illuminate\Database\Eloquent\SoftDeletes;
2023-03-16 05:20:38 +01:00
/**
* App\Models\License
*
* @property int $id
2024-02-16 08:33:45 +01:00
* @property \Carbon\Carbon $created_at
2023-03-16 05:20:38 +01:00
* @property int|null $updated_at
* @property int|null $deleted_at
* @property string|null $first_name
* @property string|null $last_name
* @property string|null $email
* @property string|null $license_key
* @property int|null $is_claimed
* @property string|null $transaction_reference
* @property int|null $product_id
* @property int|null $recurring_invoice_id
2024-02-16 08:33:45 +01:00
* @property-read \App\Models\RecurringInvoice $recurring_invoice
2023-03-16 05:20:38 +01:00
* @method static \Illuminate\Database\Eloquent\Builder|StaticModel company()
* @method static \Illuminate\Database\Eloquent\Builder|StaticModel exclude($columns)
* @method static \Illuminate\Database\Eloquent\Builder|License newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|License newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|License onlyTrashed()
* @method static \Illuminate\Database\Eloquent\Builder|License query()
* @method static \Illuminate\Database\Eloquent\Builder|License whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|License whereDeletedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|License whereEmail($value)
* @method static \Illuminate\Database\Eloquent\Builder|License whereFirstName($value)
* @method static \Illuminate\Database\Eloquent\Builder|License whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|License whereIsClaimed($value)
* @method static \Illuminate\Database\Eloquent\Builder|License whereLastName($value)
* @method static \Illuminate\Database\Eloquent\Builder|License whereLicenseKey($value)
* @method static \Illuminate\Database\Eloquent\Builder|License whereProductId($value)
* @method static \Illuminate\Database\Eloquent\Builder|License whereRecurringInvoiceId($value)
* @method static \Illuminate\Database\Eloquent\Builder|License whereTransactionReference($value)
* @method static \Illuminate\Database\Eloquent\Builder|License whereUpdatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|License withTrashed()
* @method static \Illuminate\Database\Eloquent\Builder|License withoutTrashed()
* @mixin \Eloquent
*/
2023-03-09 13:29:44 +01:00
class License extends StaticModel
{
use SoftDeletes;
2024-02-16 08:33:45 +01:00
protected $casts = [
'created_at' => 'date',
];
public function expiry(): string
{
return $this->created_at->addYear()->format('Y-m-d');
}
public function recurring_invoice()
{
return $this->belongsTo(RecurringInvoice::class);
}
public function url()
{
$contact = $this->recurring_invoice->client->contacts()->where('email', $this->email)->first();
}
}