2018-01-30 19:58:55 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
use Laracasts\Presenter\PresentableTrait;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class ExpenseCategory.
|
|
|
|
*/
|
|
|
|
class Proposal extends EntityModel
|
|
|
|
{
|
|
|
|
use SoftDeletes;
|
|
|
|
use PresentableTrait;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
protected $dates = ['deleted_at'];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
protected $fillable = [
|
2018-02-04 17:42:13 +01:00
|
|
|
'private_notes',
|
2018-02-04 20:34:38 +01:00
|
|
|
'html',
|
|
|
|
'css',
|
2018-01-30 19:58:55 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
//protected $presenter = 'App\Ninja\Presenters\ProjectPresenter';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return mixed
|
|
|
|
*/
|
|
|
|
public function getEntityType()
|
|
|
|
{
|
|
|
|
return ENTITY_PROPOSAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getRoute()
|
|
|
|
{
|
|
|
|
return "/proposals/{$this->public_id}";
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
|
|
*/
|
|
|
|
public function account()
|
|
|
|
{
|
|
|
|
return $this->belongsTo('App\Models\Account');
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return mixed
|
|
|
|
*/
|
|
|
|
public function quote()
|
|
|
|
{
|
|
|
|
return $this->belongsTo('App\Models\Invoice')->withTrashed();
|
|
|
|
}
|
|
|
|
|
2018-02-04 17:42:13 +01:00
|
|
|
/**
|
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
|
|
*/
|
|
|
|
public function proposal_template()
|
|
|
|
{
|
|
|
|
return $this->belongsTo('App\Models\ProposalTemplate')->withTrashed();
|
|
|
|
}
|
|
|
|
|
2018-01-30 19:58:55 +01:00
|
|
|
public function getDisplayName()
|
|
|
|
{
|
|
|
|
return 'TODO';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Proposal::creating(function ($project) {
|
|
|
|
$project->setNullValues();
|
|
|
|
});
|
|
|
|
|
|
|
|
Proposal::updating(function ($project) {
|
|
|
|
$project->setNullValues();
|
|
|
|
});
|