fix: complete InvesteMoz validation and error corrections
This commit is contained in:
@@ -2,6 +2,9 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Services\OpportunityMaturity;
|
||||
use App\Services\OpportunityPublicText;
|
||||
use App\Services\ProactiveInvestment;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
@@ -34,8 +37,13 @@ class Opportunity extends Model
|
||||
public function toArray(): array
|
||||
{
|
||||
$data = parent::toArray();
|
||||
if (isset($data['description'])) $data['description'] = \App\Services\OpportunityPublicText::description($this, $data['description']);
|
||||
if ($this->exists && ($proactive = app(\App\Services\ProactiveInvestment::class)->publicData($this))) $data['proactive'] = $proactive;
|
||||
if (isset($data['description'])) {
|
||||
$data['description'] = OpportunityPublicText::description($this, $data['description']);
|
||||
}
|
||||
if ($this->exists && ($proactive = app(ProactiveInvestment::class)->publicData($this))) {
|
||||
$data['proactive'] = $proactive;
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
@@ -44,7 +52,7 @@ class Opportunity extends Model
|
||||
// Only published metadata is public; never expose the current private draft.
|
||||
$version = data_get($this->workflow_context, 'publication.maturity.catalogue_version');
|
||||
|
||||
return in_array($version, [\App\Services\OpportunityMaturity::VERSION, \App\Services\OpportunityMaturity::LEGACY], true)
|
||||
return in_array($version, [OpportunityMaturity::VERSION, OpportunityMaturity::LEGACY], true)
|
||||
? $version : null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user