1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 16:31:33 +02:00
invoiceninja/app/Models/Proposal.php
2023-03-08 18:33:42 +11:00

75 lines
1.9 KiB
PHP

<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2023. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\Models;
use App\Utils\Traits\MakesHash;
/**
* App\Models\Proposal
*
* @property-read \App\Models\User|null $assigned_user
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents
* @property-read int|null $documents_count
* @property-read mixed $hashed_id
* @property-read mixed $proposal_id
* @property-read \App\Models\User $user
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel company()
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel exclude($columns)
* @method static \Illuminate\Database\Eloquent\Builder|Proposal newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|Proposal newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|Proposal query()
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel scope()
* @mixin \Eloquent
*/
class Proposal extends BaseModel
{
use MakesHash;
protected $guarded = [
'id',
];
protected $touches = [];
public function getEntityType()
{
return self::class;
}
protected $appends = ['proposal_id'];
public function getRouteKeyName()
{
return 'proposal_id';
}
public function getProposalIdAttribute()
{
return $this->encodePrimaryKey($this->id);
}
public function documents()
{
return $this->morphMany(Document::class, 'documentable');
}
public function user()
{
return $this->belongsTo(User::class)->withTrashed();
}
public function assigned_user()
{
return $this->belongsTo(User::class, 'assigned_user_id', 'id');
}
}