Commit c16858ee authored by Darron Park's avatar Darron Park

Fix media type setting's logical problem

parent 1eacf7a3
......@@ -14,9 +14,9 @@ class Setting extends Model
protected $fillable = ['name', 'value', 'description', 'isTranslatable', 'plainValue'];
protected $table = 'setting__settings';
public function hasMedia(): bool
public function isMedia(): bool
{
$value = json_decode($this->plainValue, true);
return is_array($value) && isset($value['media_single']) && $setting->files->count();
return is_array($value) && isset($value['media_single']);
}
}
......@@ -36,7 +36,7 @@ class Settings implements Setting
return is_null($default) ? $defaultFromConfig : $default;
}
if($setting->hasMedia() && $media = $setting->files->first()) {
if($setting->isMedia() && $media = $setting->files()->first()) {
return $media->path;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment