belongsTo(ProductProxy::modelClass()); } /** * Get image url for the product image. * * @return string */ public function url() { // Imported product images may store a remote/absolute URL directly in // the `path` column; return it verbatim instead of prefixing the local // storage path. if (is_string($this->path) && Str::startsWith($this->path, ['http://', 'https://'])) { return $this->path; } return Storage::url($this->path); } /** * Get image url for the product image. * * @return string */ public function getUrlAttribute() { return $this->url(); } /** * Is custom attribute. * * @param string $key * @return bool */ public function isCustomAttribute($attribute) { return $this->attribute_family->custom_attributes->pluck('code')->contains($attribute); } }