File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -656,7 +656,7 @@ public function getImageUrl()
656656 return Storage::disk ('public ' )->url (app ('assets_upload_path ' ).e ($ this ->image ));
657657 } elseif ($ this ->model && ! empty ($ this ->model ->image )) {
658658 return Storage::disk ('public ' )->url (app ('models_upload_path ' ).e ($ this ->model ->image ));
659- } elseif ($ this ->model ->category && ! empty ($ this ->model ->category ->image )) {
659+ } elseif ($ this ->model ? ->category && ! empty ($ this ->model ->category ->image )) {
660660 return Storage::disk ('public ' )->url (app ('categories_upload_path ' ).e ($ this ->model ->category ->image ));
661661 }
662662
Original file line number Diff line number Diff line change @@ -239,5 +239,11 @@ public function testGetImageUrlMethod()
239239 $ category ->save ();
240240
241241 $ this ->assertFalse ($ asset ->refresh ()->getImageUrl ());
242+
243+ // handles case where model does not exist
244+ $ asset ->model_id = 9999999 ;
245+ $ asset ->forceSave ();
246+
247+ $ this ->assertFalse ($ asset ->refresh ()->getImageUrl ());
242248 }
243249}
You can’t perform that action at this time.
0 commit comments