1 year ago

api get from s3 problem

Posted 1 year ago by haizone

hi i have a big problem with my laravel website

i build a products with a table of images

all the images is in amazone s3 now i whant to get in my indexProduct at the first image

i make that with that code:

    public function getOneImageAttribute(){
        $exists = Storage::disk('s3')->exists('products/products/'. $this->productimage->first()->image);
            return Storage::disk('s3')->url('products/products/'. $this->productimage->first()->image);
            return null;
      }else {
        return null;

and all the time i get an error:

App\Models\Product::getOneImageAttribute(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "App\Models\Productimage" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition

what can i do to fix that?

many thanks

Please sign in or create an account to participate in this conversation.