src/Models/Database/Product.php
public function getImageAttribute()
    {
        $defaultPath = '/img/default-product.jpg';
        $image = $this->images()->where('is_main_image', '=', 1)->first();

        if (null === $image) {
            return new LocalFile($defaultPath);
        }

        if ($image->path instanceof LocalFile) {
            return $image->path;
        }
    }
public function getImageAttribute()
    {
        $defaultPath = '/img/default-product.jpg';
        $image = $this->images()->where('is_main_image', '=', 1)->first();

        if (null === $image) {
            return new LocalFile($defaultPath);
        }

        if ($image->path instanceof LocalFile) {
            return $image->path;
        }
    }
public function getImageAttribute ( ) { $ defaultPath = '/img/default-product.jpg' ; $ image = $ this -> images ( ) -> where ( 'is_main_image' , '=' , 1 ) -> first ( ) ; if ( null === $ image ) { return new LocalFile ( $ defaultPath ) ; } if ( $ image -> path instanceof LocalFile ) { return $ image -> path ; } }
return default Image or LocalFile Object.

@return \AvoRed\Framework\Image\LocalFile
return default Image or LocalFile Object .