public function getFotoAttribute($value) { if ($value) { return 'data:image/' . explode('.', $value)[1] . ';base64,' . base64_encode(\Storage::get('products/' . $value)); } else { return null; } }