fix: complete InvesteMoz validation and error corrections
This commit is contained in:
+15
-4
@@ -2,10 +2,15 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
/**
|
||||
* @property list<array<string, mixed>> $specializations
|
||||
* @property string $url
|
||||
*/
|
||||
class Sector extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
@@ -20,18 +25,24 @@ class Sector extends Model
|
||||
'published_at' => 'datetime',
|
||||
];
|
||||
|
||||
/** Presentation only: historical masters and foreign keys remain untouched. */
|
||||
public function scopeChoices($query)
|
||||
/** Presentation only: historical masters and foreign keys remain untouched.
|
||||
* @param Builder<Sector> $query
|
||||
* @return Builder<Sector>
|
||||
*/
|
||||
public function scopeChoices(Builder $query): Builder
|
||||
{
|
||||
return $query->where('is_active', true)->where('slug', '!=', 'energia');
|
||||
}
|
||||
|
||||
public function scopeCatalog($query)
|
||||
/** @param Builder<Sector> $query
|
||||
* @return Builder<Sector>
|
||||
*/
|
||||
public function scopeCatalog(Builder $query): Builder
|
||||
{
|
||||
return $query->choices()->whereNotNull('published_at')->where('slug', '!=', 'fintech');
|
||||
}
|
||||
|
||||
public function getNameAttribute($value)
|
||||
public function getNameAttribute(?string $value): ?string
|
||||
{
|
||||
return ($this->attributes['slug'] ?? null) === 'fintech' ? 'Mercado Financeiro — Fintech' : $value;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user