feat(website-extras): add 'is_enabled' column to websites_extras table and update model and tests
This commit is contained in:
@@ -11,6 +11,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
'website_code',
|
||||
'website_type_extra_id',
|
||||
'config',
|
||||
'is_enabled',
|
||||
])]
|
||||
class WebsiteExtra extends Model
|
||||
{
|
||||
@@ -30,6 +31,7 @@ class WebsiteExtra extends Model
|
||||
return [
|
||||
'website_type_extra_id' => 'integer',
|
||||
'config' => 'array',
|
||||
'is_enabled' => 'boolean',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -41,11 +41,13 @@ class TenantResource extends JsonResource
|
||||
),
|
||||
'extras' => $this->whenLoaded(
|
||||
'websiteExtras',
|
||||
fn () => $this->websiteExtras->mapWithKeys(fn ($extra) => [
|
||||
$extra->websiteTypeExtra->codigo => $this->formatExtraConfig(
|
||||
$extra->resolvedConfig()
|
||||
),
|
||||
])
|
||||
fn () => $this->websiteExtras
|
||||
->filter(fn ($extra) => $extra->is_enabled)
|
||||
->mapWithKeys(fn ($extra) => [
|
||||
$extra->websiteTypeExtra->codigo => $this->formatExtraConfig(
|
||||
$extra->resolvedConfig()
|
||||
),
|
||||
])
|
||||
),
|
||||
// 1 day
|
||||
'header_logo' => $this->headerLogo?->getTemporaryUrl(1440),
|
||||
|
||||
Reference in New Issue
Block a user