Skip to content

Commit b6fef4c

Browse files
committed
Small fixes
1 parent 521423d commit b6fef4c

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/Models/AbstractAttribute.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@ protected function value(): Attribute
3535
{
3636
return Attribute::get(function ($value) {
3737
if ($this->frontend_input === 'select') {
38-
return $this->options[$value]?->value ?? $this->castAttribute('value', $value);
38+
return $this->options[$value]?->value ?? $value;
3939
}
4040

4141
$class = config('rapidez.attribute-models')[$this->backend_model] ?? null;
4242
if ($class) {
4343
return $class::value($value, $this);
4444
}
4545

46-
return $this->castAttribute('value', $value);
46+
return array_key_exists('value', $this->getCasts()) ? $this->castAttribute('value', $value) : $value;
4747
});
4848
}
4949
}

src/Models/Scopes/Product/ForCurrentWebsiteScope.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class ForCurrentWebsiteScope implements Scope
1010
{
1111
public function apply(Builder $builder, Model $model)
1212
{
13-
$builder->leftJoin('catalog_product_website', 'product_id', '=', $model->getQualifiedKeyName());
13+
$builder->leftJoin('catalog_product_website', 'catalog_product_website.product_id', '=', $model->getQualifiedKeyName());
1414
$builder->where('website_id', config('rapidez.website'));
1515
}
1616
}

src/Models/Traits/HasCustomAttributes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public function hasManyWithAttributeTypeTable($class, $type, $foreignKey = null,
9999
public function customAttributes(): Attribute
100100
{
101101
return Attribute::get(function () {
102-
if (@! $this->attributeDatetime) {
102+
if (!$this->relationLoaded('attributeDatetime')) {
103103
return collect();
104104
}
105105

0 commit comments

Comments
 (0)