2018-10-22 14:04:37 +02:00
|
|
|
<?php
|
2019-05-11 05:32:07 +02:00
|
|
|
/**
|
|
|
|
* Invoice Ninja (https://invoiceninja.com)
|
|
|
|
*
|
|
|
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
|
|
*
|
2020-01-07 01:13:47 +01:00
|
|
|
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
2019-05-11 05:32:07 +02:00
|
|
|
*
|
|
|
|
* @license https://opensource.org/licenses/AAL
|
|
|
|
*/
|
2018-10-22 14:04:37 +02:00
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
2018-11-20 05:36:56 +01:00
|
|
|
use App\Utils\Traits\MakesHash;
|
2018-10-22 14:04:37 +02:00
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
|
2018-11-02 11:54:46 +01:00
|
|
|
class Proposal extends BaseModel
|
2018-10-22 14:04:37 +02:00
|
|
|
{
|
2018-11-20 05:36:56 +01:00
|
|
|
use MakesHash;
|
2018-10-22 14:04:37 +02:00
|
|
|
|
2019-12-30 22:59:12 +01:00
|
|
|
protected $guarded = [
|
|
|
|
'id',
|
|
|
|
];
|
2018-11-20 05:36:56 +01:00
|
|
|
|
|
|
|
protected $appends = ['proposal_id'];
|
|
|
|
|
|
|
|
public function getRouteKeyName()
|
|
|
|
{
|
|
|
|
return 'proposal_id';
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getProposalIdAttribute()
|
2018-10-22 14:04:37 +02:00
|
|
|
{
|
2018-11-20 05:36:56 +01:00
|
|
|
return $this->encodePrimaryKey($this->id);
|
2018-10-22 14:04:37 +02:00
|
|
|
}
|
|
|
|
|
2019-04-28 07:31:32 +02:00
|
|
|
public function documents()
|
|
|
|
{
|
|
|
|
return $this->morphMany(Document::class, 'documentable');
|
|
|
|
}
|
2018-11-20 05:36:56 +01:00
|
|
|
|
2019-11-05 11:16:38 +01:00
|
|
|
public function assigned_user()
|
|
|
|
{
|
2019-12-30 22:59:12 +01:00
|
|
|
return $this->belongsTo(User::class, 'assigned_user_id', 'id');
|
2019-11-05 11:16:38 +01:00
|
|
|
}
|
2018-10-22 14:04:37 +02:00
|
|
|
}
|